thanks,
i need something that when a user clicks the add to cart button it stores it in a session so the cart index page can display it. i can get this to work using this...
<form action="/cart/addtocart.php" method="post" id="form">
<input type="image" name="Add To Cart" src="/images/add.png" />
<input name="id" type="hidden" id="id" value="<? echo $rows['id']; ?>" />
</form>
<? session_start();
if ( !isset( $_SESSION["cart"] ) ) {
$_SESSION["cart"] = array();
}
$id = $_POST["id"];
$_SESSION["cart"][$id] = $id;
header("location:index.php");
?>
<?php
foreach($_SESSION['cart'] as $value)
{
?>
<table width="100%" border="0" cellpadding="2" cellspacing="1"><tr><td><?php
$con = mysql_connect("xxxx");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("xxxx", $con);
$result = mysql_query("SELECT * FROM items WHERE id='$value'");
$info = mysql_fetch_array( $result);
$count=mysql_num_rows($result);
?>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td align="left" valign="middle" nowrap="NOWRAP"><form id="id" name="id" method="post" action="/cart/remove_item.php">
<INPUT TYPE="IMAGE" SRC="/images/x2.gif" ALT="Remove This Item">
<input name="id" type="hidden" id="id" value="<?php echo $info['id']; ?>" />
</form> <a href="/remove_item.php"></a></td>
<td align="left" valign="bottom" nowrap="NOWRAP"> </td>
<td width="60" height="60" align="center" valign="middle" nowrap="NOWRAP"><img src="<? echo $info['image']; ?>" alt="<?
echo "#";
echo $info['code'];
echo " - ";
echo $info['name'];
?>" class="cartimage"/></td>
<td width="100" align="left" valign="middle" nowrap="NOWRAP"><? echo $info['code']; ?></td>
<td width="90%" align="left" valign="middle"><strong><? echo $info['name']; ?></strong></td>
<td align="right" valign="middle"><form id="form1" name="form1" method="post" action="" style="display:inline">
<input name="qty" type="text" id="qty" size="1" />
</form>
</td>
<td align="left" valign="middle" nowrap="nowrap">£<? echo $info['price']; ?></td>
</tr>
</table></td>
</tr></table>
<?
$sub[]=$info['price'];
}
?>
how do i get the quantity to work?