Here's the code including the code immediatly preceeding the code you suggested I add. Can you help me determine where the parse error is coming from?
<?php
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 = $SERVER['PHP_SELF'];
if (isset($SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
$offset = -8*3600;
$current_local_time = time() + $offset;
if ((isset($POST["MM_insert"])) && ($POST["MM_insert"] == "insertForm"))
{
$insertSQL = sprintf("INSERT INTO user_tbl (user_id, user_password, role, user_first_name, user_last_name, date_added) VALUES (%s, %s, %s, %s, %s, %s)",
GetSQLValueString($POST['user_id'], "text"),
GetSQLValueString($POST['password'], "text"),
GetSQLValueString($POST['role'], "int"),
GetSQLValueString($POST['first_name'], "text"),
GetSQLValueString($_POST['last_name'], "text"),
GetSQLValueString(date("Y-m-d H:i:s", $current_local_time), "date"));
}
mysql_select_db($database_test_data, $test_data);
$Result1 = mysql_query($insertSQL, $test_data) or die(mysql_error());
$insertGoTo = "userMaster.php";
if (isset($SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>