Jump to content

retrive data


samsalar2008

Recommended Posts

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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.