FairyBusiness
asked on
Why does my page need to be refreshed to show the shopping cart update?
Hi, I have a function that returns the correct update:
function updateCart() {
if((isset($_POST['update'] )) && (isset($_POST['qty'])) && (isset($_POST['item']))) {
$item = trim(mysql_clean_strings($ _POST['ite m']));
$qty = trim(mysql_clean_strings($ _POST['qty ']));
$cart = $_SESSION['cart'];
$_SESSION['cart'][$item] = $qty;
var_dump($qty);
return $qty;
}
}
but it doesn't show the update till the next time (either enter a new quantity or click refresh). How can I make it show the changes on the first click (submit) ?
You will need to add something first:
http://auroriella.com/bracelet.php?item=b3
function updateCart() {
if((isset($_POST['update']
$item = trim(mysql_clean_strings($
$qty = trim(mysql_clean_strings($
$cart = $_SESSION['cart'];
$_SESSION['cart'][$item] = $qty;
var_dump($qty);
return $qty;
}
}
but it doesn't show the update till the next time (either enter a new quantity or click refresh). How can I make it show the changes on the first click (submit) ?
You will need to add something first:
http://auroriella.com/bracelet.php?item=b3
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER