Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Locked
0

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

New Here ,
Jun 03, 2011 Jun 03, 2011

Copy link to clipboard

Copied

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

TOPICS
Server side applications

Views

281
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 04, 2011 Jun 04, 2011

Copy link to clipboard

Copied

LATEST

Duplicate post. Locking this thread.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines