ok guys i have htis up and running..
its simply a table used as a shopping cart..
im currently working on removal of an item.
Problem is i need to somehow give the remove button a unique id based on each row..
at the moment if oyu hit remove it deletes whatever was last printed.
any suggestions?
<?
include("header.php");
$id = $_COOKIE['username'];
?>
<table border="1" cellpadding="10" cellspacing="0" align="center"><tr><td colspan="6" align="center"><h2>CHECKOUT</h2></b></td></tr>
<td align="center"><h3>Preview</h3></td><td align="center"><h3>Shirt</h3></td><td align="center"><h3>Size</h3></td><td align="center"><h3>Colour</h3></td><td align="center"><h3>Quantity</h3></td><td align="center"><h3>Remove</h3></td></tr>
<?
// Displays the table for the current client
$sql = "select * from client_order where login = '$id'";
$result=mysql_query($sql)
or die(mysql_error());
while($row=mysql_fetch_array($result))
//start of output!
{
$ordercode = $row['ordercode'];
$qty = $row['qty'];
$shirt = substr($ordercode,0,2);
$colorcode = substr($ordercode,2,2);
$size = substr($ordercode,4,2);
//gets the order from order code
$qry = "select * from shirt where id = '$shirt'";
$q1 = mysql_query($qry) or die (mysql_error());
while($row=mysql_fetch_array($q1))
{
$shirt = $row['name'];
}
//gets the color from order code
$qry = "select * from colour where code = '$colorcode'";
$q2 = mysql_query($qry) or die (mysql_error());
while($row=mysql_fetch_array($q2))
{
$colorcode = $row['name'];
}
//gets the size from order code
$qry = "select * from sizes where code = '$size'";
$q3 = mysql_query($qry) or die (mysql_error());
while($row=mysql_fetch_array($q3))
{
$size = $row['name'];
}
//gets the shirt gif url from order code
$qry = "select * from shirt where name = '$shirt'";
$q4 = mysql_query($qry) or die (mysql_error());
while($row=mysql_fetch_array($q4))
{
$shirtpic = $row['gif'];
}
Print("<td align='center'><img src='".$shirtpic."'></a></td>");
Print("<td align='left'>".$shirt."</td>");
Print("<td align='center'>".$size."</td>");
Print("<td align='center'>".$colorcode."</td>");
?>
<form name="blah" action="<?=$php_self?>" method="post">
<td align="center">
<?
// allows quantity to be updated
if (!isset($qty1))
{
$qty1 = $qty;
}
?>
<input name="qty1" type="text" size="1" value="<?=$qty1?>"><input type="submit" value="update">
</td></form>
<?
// removal section
Print("<form name='remove' method='get' action='remove.php'><td><input type='submit' value='Remove Item'></td></tr><input type='hidden' name='remove' value='remove'><input type='hidden' name='shirt' value='$shirt'><input type='hidden' name='colorcode' value='$colorcode'></form>");
// end of removal
}
// end of inital while display query
?>
</tr></table>
<?
include("footer.php");
?>