Jump to content

Equivalent of * in a $_SESSION?


Recommended Posts

There is. I just re-wrote my code:

 

if ($_POST['size'] == "Small") {
if (isset($_SESSION['cart']['content'][$_POST[id]])) {
	$_SESSION['cart']['content'][$_POST[id]]['sizes'] += $_POST['quantity'];
} else {
	$_SESSION['cart']['content'][$_POST[id]] = array ('id' => $_POST['id'], 'sizes' => $_POST['quantity']);
}
} elseif ($_POST['size'] == "Large") {
if (isset($_SESSION['cart']['content'][$_POST[id]])) {
	$_SESSION['cart']['content'][$_POST[id]]['sizel'] += $_POST['quantity'];
} else {
	$_SESSION['cart']['content'][$_POST[id]] = array ('id' => $_POST['id'], 'sizel' => $_POST['quantity']);
}
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.