Hi folks,
I am having a problem getting this to work (obviously,or I wouldn't be here ;). The 'cancel_booking.php' site eats the booking number and reloads. It doesn't even have the decency of deleting the record!?!
Any help would ge greatly appreciated.
Here is the code:
<?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;
}
if ((isset($_GET['bookingID'])) && ($_GET['bookingID'] != "") && (isset($_POST['bookingID']))) {
$deleteSQL = sprintf("DELETE FROM bookings WHERE ID=%s",
GetSQLValueString($_GET['bookingID'], "int"));
mysql_select_db($database_rsBooking, $rsBooking);
$Result1 = mysql_query($deleteSQL, $rsBooking) or die(mysql_error());
$deleteGoTo = "booking_cancelled.php?bookingID=".$_POST_VARS['bookingID']."";
if (isset($_SERVER['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
}
?>