Skip to content

Instantly share code, notes, and snippets.

@phpfiddle
Created December 8, 2016 10:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phpfiddle/46514909ab9f9aa9746797aca0b2d5f4 to your computer and use it in GitHub Desktop.
Save phpfiddle/46514909ab9f9aa9746797aca0b2d5f4 to your computer and use it in GitHub Desktop.
[ 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