samsalar2008 Posted April 8, 2012 Share Posted April 8, 2012 hi this is my code but I can't see the array in echo <table> <tr> <td> <h3> <?php //if the cart is empty show the message if (!$cart && !$_POST['item']) { echo "No cart available."; $cart = array(); } else{ //if the new item added to the cart let the customer knows if ($_POST['item']) { echo "Added to your cart: " . $_POST['item']; } } ?> </h3> </td> </tr> <tr> <?php //if the cart isn't empty show the cart if ($cart) { $cart[] = $_POST['item'];} foreach($cart as $key => $value) { echo'<td> <img src="images/'.$value.'.jpg" alt="'.$value.'" /> </td> <td> <form> <p> '.$value.' = <input type="text" size="2" name="number" value="1" /> </p> </form> </td> <td> <form method="post" action="update.php"> <p> <input type="submit" name="submit" value="Update This One Item" /> </p> <form> </td> <br />'; } ?> </tr> </table> Quote Link to comment https://forums.phpfreaks.com/topic/260529-retrive-data/ Share on other sites More sharing options...
sunfighter Posted April 9, 2012 Share Posted April 9, 2012 Please use the above '#' to wrap your code in. You do not define $cart in your code. And a question for you is $_POST['item'] an array? And what is it's value? Quote Link to comment https://forums.phpfreaks.com/topic/260529-retrive-data/#findComment-1335683 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.