redarrow Posted June 25, 2006 Share Posted June 25, 2006 how can i add to basket with sessions so if the user press add to basket the session adds the items up and shows the product.please help thank you.my example[code]<? session_start();$product="tv";$for_sale=$_SESSION["tv"]=$product;$price=10;$on_sale=$_SESSION["price"]=$price;echo "<br>price $on_sale<br> product $for_sale<br>";?><html><body><form method="post" action""><input type="text" name="for_sale" value="<? echo $for_sale ?>"><input type="text" name="on_sale" value="<? echo $on_sale ?>"><input type="submit" value="add to basket"></form></body></html><?$product="hi fi";$for_sale=$_SESSION["tv"]=$product;$price=20;$on_sale=$_SESSION["price"]=$price;echo "<br>price $on_sale<br> product $for_sale<br>";?><form method="post" action""><input type="text" name="for_sale" value="<? echo $for_sale ?>"><input type="text" name="on_sale" value="<? echo $on_sale ?>"><input type="submit" value="add to basket"></form></body></html><?if(!$_POST['submit']) {$on_sale+$on_sale;echo"Your Basket<br>product $for_sale<br>total price $on_sale ";}?>[/code] Link to comment https://forums.phpfreaks.com/topic/12843-add-to-basket-help/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.