I currently have a table populated from an array. The issue i'm having is storing the products on "Add to Cart"
<?php
session_start();
$products = array(
array('SKU'=>'test1', 'name'=>'ProductTest1', 'Price'=>10.00),
array('SKU'=>'test2', 'name'=>'ProductTest2', 'Price'=>11.00),
array('SKU'=>'test3', 'name'=>'ProductTest3', 'Price'=>12.00)
);
if(isset($_GET['action' && $_get['action'] == "addToCart"))
{
$id = $_GET['product']);
if(isset($_SESSION['cart'][$id])){
$_SESSION['cart'][$id]['quantity']++;
}
else
{
?>
Below is also the table php which populates correctly.
<?php foreach ($products as $key => $product) {
echo '<tr>';
echo '<td>' . $product['SKU'] . '</td>';
echo '<td>' . $product['name'] . '</td>';
echo '<td>' . '£'. number_format($product['Price'],2) . '</td>';
echo '<td><a href="?action=addToCart&product='. $key.'">Add To Cart </a></td>';
echo '</tr>';
}
?>
I can't figure out how to store the name and price of the items using the GET function, which should take the value from the URL.
Any help would be great!