Create a gist now

Instantly share code, notes, and snippets.

[ Posted by Marlon Mendoza ] addtocartprocess.php
<?php
if (session_status() == PHP_SESSION_NONE) {
//there is a session start code here but the website disabled it
$_SESSION['cart'] = array();
}
$connection = mysql_connect("localhost", "root", "");
if(isset($_GET['add_to_cart'])){
array_push($_SESSION['cart'], $_GET['product_id']);
header("location: ../android.php?id=" . $_GET['product_id'] . "");
}
mysql_close($connection);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment