In this code, I can't fetch id value. How can I give a number instead of if(strlen)
? And how can I give remove one by one item ?
<?Php
@$product=$_POST['product'];
if (strlen($product)>3) {
array_push($_SESSION['cart'],$product); // Items added to cart
}
?>
<?Php
if (isset($_SESSION['cart'])) {
echo " <br><a href=cart-remove-all.php>Remove all</a><br>";
while (list ($key, $val) = each ($_SESSION['cart'])) {
echo "$key -> $val <br>";
} else {
echo " Session Cart is not created. Visit <a href=cart.php>cart.php</a> page
to create the array and add products to it. ";
}
?>
<form method="post">
<input type="hidden" name="product" value="<?php echo $row['jobtitle'];?>">
<input type="submit" style="float:right;font-size:15px;font-weight:600;" value="+ Add to Short List">
</form>