Notice: Undefined index:
i have this working fine on another site and have just replicated it but on this site it isnt working, can someone see what i am doing wrong?
i am having an error come up on my success.php page when returning from a paypal payment..
Notice: Undefined index: OrderID in E:\Domains\b\website.com\user\htdocs\success.php on line 248
basically when the transaction is successful the return page is return.php, this page tells
<?php
session_start();
$colname_rsReturn = "-1";
if (isset($_SESSION['OrderID'])) {
$colname_rsReturn = $_SESSION['OrderID'];
}
mysql_select_db($database_beau, $beau);
$query_rsReturn = sprintf("SELECT Fulfilled FROM beauSS13_orders WHERE beauSS13_orders.OrderID = %s", GetSQLValueString($colname_rsReturn, "int"));
$rsReturn = mysql_query($query_rsReturn, $beau) or die(mysql_error());
$row_rsReturn = mysql_fetch_assoc($rsReturn);
$totalRows_rsReturn = mysql_num_rows($rsReturn);
if ($row_rsReturn['Fulfilled'] == 1) {
header ("Location: success.php");
} else header ("Location: failed-order.php");
?>
so the value of the order is 1 then it send to success.php to update the stock as follows
<?php
// *** Update the stock ***
$details_table = "beauSS13_orderdetails";
$ID_column = "OrderID";
$details_prodID = "ProductID";
$details_qty = "Quantity";
$XStock_TableName = "beauSS13_products";
$XStock_FieldName = "Stock";
$XStock_unID = "ProductID";
if (!session_id()) session_start();
if (isset($_SESSION["OrderID"])) {
mysql_select_db($database_beau, $beau);
$details_Source = "select * from " . $details_table . " where " . $ID_column . " = " . $_SESSION["OrderID"];
$detailsRS = mysql_query($details_Source, $beau) or die(mysql_error());
$row_detailsRS = mysql_fetch_assoc($detailsRS);
do {
$XStock_qtySource = "select " . $XStock_FieldName . " from " . $XStock_TableName . " where " . $XStock_unID . " = " . $row_detailsRS[$details_prodID] . "";
$XStock_rsUpd = mysql_query($XStock_qtySource, $beau) or die(mysql_error());
$row_XStock_rsUpd = mysql_fetch_assoc($XStock_rsUpd);
if ($row_XStock_rsUpd[$XStock_FieldName] > 0) {
$XStock_new = $row_XStock_rsUpd[$XStock_FieldName] - $row_detailsRS[$details_qty];
if ($XStock_new < 0) $XStock_new = 0;
$XStock_UpdSource = "update " . $XStock_TableName . " set " . $XStock_FieldName . " = " . $XStock_new . " where " . $XStock_unID . " = " . $row_detailsRS[$details_prodID] . "";
$XStock_rsUpd = mysql_query($XStock_UpdSource, $beau) or die(mysql_error());
}
} while ($row_detailsRS = mysql_fetch_assoc($detailsRS));
$XStock_rsUpd = null;
$detailsRS = null;
session_unregister("OrderID");
}
?>
but when i get to this page i am getting the error
Notice: Undefined index: OrderID in E:\Domains\b\website.com\user\htdocs\success.php on line 248
and the stock isnt getting updated
line 248 is <p>Order <?php echo $_SESSION['OrderID']; ?> Successful<br />
so this is telling me that the session isnt being carried accross?
