multipleintell
Technical User
I want to allow the user to insert a record, then pass a parameter to the redirect page to display the record's information.
I want to put a parameter here, but it finds no record even though the record does successfully insert into my database:
$insertGoTo = "/TalentDetail.php?TalentID=<?php echo $row_SelectTalentName['TalentID'];?>";
Here is my current code:
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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 = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}
if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form3")) {
$insertSQL = sprintf("INSERT INTO talenttbl (TalentID, LName, FName, DOB, ChildSize, Inseam, Dress, Shoe, Shirt, Suit, Chest, Hips, Waist, Height, Division, HairColor, EyeColor) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['TalentID'], "int"),
GetSQLValueString($HTTP_POST_VARS['LName'], "text"),
GetSQLValueString($HTTP_POST_VARS['FName'], "text"),
GetSQLValueString($HTTP_POST_VARS['DOB'], "date"),
GetSQLValueString($HTTP_POST_VARS['ChildSize'], "text"),
GetSQLValueString($HTTP_POST_VARS['Inseam'], "double"),
GetSQLValueString($HTTP_POST_VARS['Dress'], "text"),
GetSQLValueString($HTTP_POST_VARS['Shoe'], "double"),
GetSQLValueString($HTTP_POST_VARS['Shirt'], "int"),
GetSQLValueString($HTTP_POST_VARS['Suit'], "text"),
GetSQLValueString($HTTP_POST_VARS['Chest'], "double"),
GetSQLValueString($HTTP_POST_VARS['Hips'], "double"),
GetSQLValueString($HTTP_POST_VARS['Waist'], "double"),
GetSQLValueString($HTTP_POST_VARS['Height'], "double"),
GetSQLValueString($HTTP_POST_VARS['Division'], "text"),
GetSQLValueString($HTTP_POST_VARS['HairColor'], "text"),
GetSQLValueString($HTTP_POST_VARS['EyeColor'], "text"));
mysql_select_db($database_ImageNetfirms, $ImageNetfirms);
$Result1 = mysql_query($insertSQL, $ImageNetfirms) or die(mysql_error());
$insertGoTo = "/TalentDetail.php";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
I want to put a parameter here, but it finds no record even though the record does successfully insert into my database:
$insertGoTo = "/TalentDetail.php?TalentID=<?php echo $row_SelectTalentName['TalentID'];?>";
Here is my current code:
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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 = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}
if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form3")) {
$insertSQL = sprintf("INSERT INTO talenttbl (TalentID, LName, FName, DOB, ChildSize, Inseam, Dress, Shoe, Shirt, Suit, Chest, Hips, Waist, Height, Division, HairColor, EyeColor) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['TalentID'], "int"),
GetSQLValueString($HTTP_POST_VARS['LName'], "text"),
GetSQLValueString($HTTP_POST_VARS['FName'], "text"),
GetSQLValueString($HTTP_POST_VARS['DOB'], "date"),
GetSQLValueString($HTTP_POST_VARS['ChildSize'], "text"),
GetSQLValueString($HTTP_POST_VARS['Inseam'], "double"),
GetSQLValueString($HTTP_POST_VARS['Dress'], "text"),
GetSQLValueString($HTTP_POST_VARS['Shoe'], "double"),
GetSQLValueString($HTTP_POST_VARS['Shirt'], "int"),
GetSQLValueString($HTTP_POST_VARS['Suit'], "text"),
GetSQLValueString($HTTP_POST_VARS['Chest'], "double"),
GetSQLValueString($HTTP_POST_VARS['Hips'], "double"),
GetSQLValueString($HTTP_POST_VARS['Waist'], "double"),
GetSQLValueString($HTTP_POST_VARS['Height'], "double"),
GetSQLValueString($HTTP_POST_VARS['Division'], "text"),
GetSQLValueString($HTTP_POST_VARS['HairColor'], "text"),
GetSQLValueString($HTTP_POST_VARS['EyeColor'], "text"));
mysql_select_db($database_ImageNetfirms, $ImageNetfirms);
$Result1 = mysql_query($insertSQL, $ImageNetfirms) or die(mysql_error());
$insertGoTo = "/TalentDetail.php";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}