I created a simple form using PHP. One of the values is defined from a cookie and the rest are input by the user. I keep running into a problem where I can get the cookie data to submit to the database, but then the next 2 fields show up as NULL. The form fields after that send their data to the database as they should. What causes this? Anyone know? I tried adding dummy fields in the form to allow for the NULL fields to just happen, but that doesn't seem to be a very good fix.
Here is the code I'm working with:
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO discbaginput (MemberID, Brand, Maker, Type, Plastic, Color, DiscWeight, DiscCondition, Lost, LostDate, LostWhere, Comments, DiscNumber) VALUES ('$MemberID', %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['MemberID'], "int"),
GetSQLValueString($_POST['Brand'], "text"),
GetSQLValueString($_POST['Maker'], "text"),
GetSQLValueString($_POST['Type'], "text"),
GetSQLValueString($_POST['Plastic'], "text"),
GetSQLValueString($_POST['Color'], "text"),
GetSQLValueString($_POST['DiscWeight'], "int"),
GetSQLValueString($_POST['DiscCondition'], "text"),
GetSQLValueString(isset($_POST['Lost']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString($_POST['LostDate'], "date"),
GetSQLValueString($_POST['LostWhere'], "text"),
GetSQLValueString($_POST['Comments'], "text"),
GetSQLValueString($_POST['DiscNumber'], "int"));
mysql_select_db($database_connDiscBros, $connDiscBros);
$Result1 = mysql_query($insertSQL, $connDiscBros) or die(mysql_error());
Thanks for any input on this. It's driving me nuts!