Forums
This topic is locked
INSERT Statement not updating db
Posted 15 Sep 2004 21:45:54
1
has voted
15 Sep 2004 21:45:54 Fernando Cuis posted:
Good Day All,www.hornerxpressfinancialservices.com/dealers/reg.php
For some reason my INSERT statement does not update my database. Upon submit, it simply reloads the same page, even though i have it set to redirect to login.php upon INSERT.
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = ""

{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != ""

break;
case "long":
case "int":
$theValue = ($theValue != ""

break;
case "double":
$theValue = ($theValue != ""

break;
case "date":
$theValue = ($theValue != ""

break;
case "defined":
$theValue = ($theValue != ""

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"] == "hfsReg"

$insertSQL = sprintf("INSERT INTO accountinfo (UserName, Password, FirstName, Address, City, `State`, Zip, Phone, Fax, Email, Company, userGroup) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['username'], "text"

GetSQLValueString($_POST['password'], "text"

GetSQLValueString($_POST['name'], "text"

GetSQLValueString($_POST['address'], "text"

GetSQLValueString($_POST['city'], "text"

GetSQLValueString($_POST['state'], "text"

GetSQLValueString($_POST['zip'], "text"

GetSQLValueString($_POST['phone'], "text"

GetSQLValueString($_POST['fax'], "text"

GetSQLValueString($_POST['email'], "text"

GetSQLValueString($_POST['company'], "text"

GetSQLValueString($_POST['userGroup'], "text"

mysql_select_db($database_hfsphp, $hfsphp);
$Result1 = mysql_query($insertSQL, $hfsphp) or die(mysql_error());
$insertGoTo = "www.hornerxpressfinancialservices.com/dealers/login.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
If anyone can help, i figured it would be here!
Thanks,
-F