Skip to main content
Participant
June 3, 2011
Question

Access to “user_name” using DW’s insert record service side behavior????

  • June 3, 2011
  • 1 reply
  • 309 views

Access to “user_name” using DW’s insert record service side behavior????

I am a newbie using DW CS5.  I have registered and inserted into a user table a new user.  This part work.  On the next web page, I want to print “ Welcome [user_name]”.

I have tried to use $user_name and also $_POST[user_name] without any success.  Apparent (?) the DW’s insert record service side behavior does not use POST but  $_POST["MM_insert"] and $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);

The full code of a different "test" (using lname and fname as the fields) form is below.

if (!function_exists("GetSQLValueString")) {

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

{

  if (PHP_VERSION < 6) {

    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {

    case "text":

      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

      break;   

    case "long":

    case "int":

      $theValue = ($theValue != "") ? intval($theValue) : "NULL";

      break;

    case "double":

      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";

      break;

    case "date":

      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

      break;

    case "defined":

      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;

      break;

  }

  return $theValue;

}

}

$editFormAction = $_SERVER['PHP_SELF'];

if (isset($_SERVER['QUERY_STRING'])) {

  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);

}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "frmTEST")) {

  $insertSQL = sprintf("INSERT INTO testtable (fname, lname) VALUES (%s, %s)",

                       GetSQLValueString($_POST['fname'], "text"),

                       GetSQLValueString($_POST['lname'], "text"));

  mysql_select_db($database_ndc_olcs, $ndc_olcs);

  $Result1 = mysql_query($insertSQL, $ndc_olcs) or die(mysql_error());

  $insertGoTo = "testOK.php";

  if (isset($_SERVER['QUERY_STRING'])) {

    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";

    $insertGoTo .= $_SERVER['QUERY_STRING'];

  }

  header(sprintf("Location: %s", $insertGoTo));

}

Thanks

This topic has been closed for replies.

1 reply

David_Powers
Inspiring
June 4, 2011

Duplicate post. Locking this thread.