session created by form inputs not sending to database

I have a form that has form inputs, 3 of these make a session that needs to be sent to the database but it doesnt send the session to the column in the database

when i try the below script i am getting

“Column ‘orderID’ cannot be null”
whuch means the session isnt being constructed and echoed out into the orderID value

here is my code

[php]if ((isset($_POST[“MM_insert”])) && ($_POST[“MM_insert”] == “form1”)) {
$insertSQL = sprintf(“INSERT INTO wildOrchidRes (ID, orderID, name, address, town, county, postCode, country, email, telephone, checkIn, checkOut, amount) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)”,
GetSQLValueString($_POST[‘ID’], “int”),
GetSQLValueString($_POST[‘orderID’], “text”),
GetSQLValueString($_POST[‘name’], “text”),
GetSQLValueString($_POST[‘address’], “text”),
GetSQLValueString($_POST[‘town’], “text”),
GetSQLValueString($_POST[‘county’], “text”),
GetSQLValueString($_POST[‘postCode’], “text”),
GetSQLValueString($_POST[‘country’], “text”),
GetSQLValueString($_POST[‘email’], “text”),
GetSQLValueString($_POST[‘telephone’], “text”),
GetSQLValueString($_POST[‘checkIn’], “date”),
GetSQLValueString($_POST[‘checkOut’], “date”),
GetSQLValueString($_POST[‘amount’], “double”));

mysql_select_db($database_WO, $WO);
$Result1 = mysql_query($insertSQL, $WO) or die(mysql_error());

session_start();//created order session
$_SESSION[‘orderID’] = $_POST[‘name’] . $_POST[‘checkIn’] . $_POST[‘checkOut’] ;

$insertGoTo = “confirm.php”;
if (isset($_SERVER[‘QUERY_STRING’])) {
$insertGoTo .= (strpos($insertGoTo, ‘?’)) ? “&” : “?”;
$insertGoTo .= $_SERVER[‘QUERY_STRING’];
header(sprintf(“Location: %s”, $insertGoTo));


any ideas as getting a bit desperate

should the first %s be a %d as you state it’s an int (not string)
[php]VALUES (%s, %s …
GetSQLValueString($_POST[‘ID’], “int”)[/php]

Red :wink:

hi, that doesnt make a difference. I have now tried creating the SESSION before the INSERT but again still not working

Sponsor our Newsletter | Privacy Policy | Terms of Service