Hi all,
Im trying to add sizes to the cart. However, i cant pass size over. please help.
$result = $db->query($sql);
$output[] = '<ul>';
while ($row = $result->fetch()) {
$output[] = '<br><font color="837F77"size="6">'.$row['name'].' </font><br></br> S$'.$row['price'].'<br></br>';
$output[] = '<select name="size">
<option disabled="disabled" selected value="NA" >Size</option>';
if ($row[small_qty]== 0){
$output[] = ' <option disabled="disabled" value="NA" >Small</option>';
}else {
$output[] = '<option value="s">Small</option>';
}
if ($row[medium_qty]== 0){
$output[] = ' <option disabled="disabled" value="NA" >Medium</option>';
}else {
$output[] = '<option value="m">Medium</option>';
}
if ($row[large_qty]== 0){
$output[] = ' <option disabled="disabled" value="NA" >Large</option>';
}else {
$output[] = ' <option value="l">Large</option>';
}
$output[] = '</select>';
$output[] = '<br></br><a href="cart.php?action=add&product_id='.$row['product_id'].'&p='.$size.'" value="Submit"> <img src="image/addbutton.png" border="0" /></a></a>
</li>';
}
$output[] = '</ul>';
echo join('',$output);
GET
<?php
// Start the session
session_start();
// Process actions
$cart = $_SESSION['cart'];
$action = $_GET['action'];
$size= $_GET['p'];
$size1 = $_POST['size'];
//if there is an product_id and that product_id doesn't exist display an error message
if($product_id && !productExists($product_id)) {
die("Error. Product Doesn't Exist");
}
echo $size;
echo $action ;
echo $size1 ;
echo $_GET['product_id'];
switch ($action) {
case 'add':
if ($cart) {
$cart .= ','.$_GET['product_id'];
} else {
$cart = $_GET['product_id'];
}
break;
Any other idea?
Help is much appreciated, im sorry , im still learning