Hi, I'm having a trouble with dynamic redirection. I've searched for everything and did $_GET and $_POST but still not working. The $id is not returning any results.
Here's my code:
include_once("includes/connection.php");
global $result;
putenv("TZ=Asia/Manila");
$arrErrors = array();
$oid = isset($_GET['oid']) ? intval($_GET['oid']) : 0;
$package_id = isset($_GET['package_id']) ? intval($_GET['package_id']) : 0;
if (count($_POST)) {
//Post Form values
$addon_id = isset($_POST['addon_id']) ? intval($_POST['addon_id']) : 0;
$itemname = isset($_POST['itemname']) ? trim($_POST['itemname']) : "";
$subtotal = isset($_POST['subtotal']) ? trim($_POST['subtotal']) : "";
$total_price= isset($_POST['total_price']) ? trim($_POST['total_price']) : "";
//Check for errors
//Save/Update record/s if no errors found
if (count($arrErrors) == 0) {
$creation_date = strftime("%Y-%m-%d %H:%M:%S");
if ($oid > 0) {
$query = "UPDATE orders SET package_id = '$package_id', addon_id = '$addon_id', itemname = '$itemname', subtotal = '$subtotal', total_price = '$total_price', creation_date = '$creation_date' WHERE oid = '$oid'";
}
else {
$query = "INSERT INTO orders (package_id, addon_id, itemname, subtotal, total_price, creation_date) VALUES ('$package_id', '$addon_id', '$itemname', '$subtotal', '$total_price', '$creation_date')";
}
$result = mysql_query($query) or die(mysql_error());
if ($result) {
[COLOR="Red"]header("Location: checkout.php?oid=".$_POST['oid']."");[/COLOR]
}
}
}
if ($oid > 0) {
$query = "SELECT * FROM orders WHERE oid='{$oid}'";
$result = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_assoc($result)) {
$package_id = $row['package_id'];
$addon_id = $row['addon_id'];
$itemname = $row['itemname'];
$subtotal = $row['subtotal'];
$total_price= $row['total_price'];
$creation_date= $row['creation_date'];
}
}
?>
Your help would be greatly appreciated.
Thanks Guys!