Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (isset($_POST["add_to_cart"])) {
- if ($_GET["action"] == "add") {
- if (isset($_SESSION["cart"])) {
- $item_array_id = array_column($_SESSION["cart"], "id");
- $count = count($_SESSION["cart"]) + 1;
- $item_array = array(
- 'id' => generate_random_letters(5),
- 'name' => $_POST["product_name"],
- 'price' => $_POST["product_price"],
- 'quantity' => $_POST["product_quantity"],
- 'description' => $_POST["product_description"],
- 'product_additional_info' => $_POST['product_additional_info'],
- 'salate_sauce' => $_POST['salate_sauce'],
- );
- $_SESSION["cart"][$count] = $item_array;
- header("Location: app_orders.php?action=product_added");
- } else {
- $item_array = array(
- 'id' => generate_random_letters(5),
- 'name' => $_POST["product_name"],
- 'price' => $_POST["product_price"],
- 'quantity' => $_POST["product_quantity"],
- 'description' => $_POST["product_description"],
- 'product_additional_info' => $_POST['product_additional_info'],
- 'salate_sauce' => $_POST['salate_sauce'],
- );
- $_SESSION["cart"][0] = $item_array;
- }
- }
- }
- if ($_GET["action"] == "delete") {
- foreach ($_SESSION["cart"] as $keys => $value) {
- if ($value["id"] == $_GET["id"]) {
- unset($_SESSION["cart"][$keys]);
- header("Location: app_orders.php?action=product_deleted");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement