Basically i need to be able to update the quantity and/or be able to delete the item. the code shown works fine for the last row in the table. I really need to be able to loop it through all of the rows of the table and still function for all of them individually. right now the it only works on the row if i put the while statement in it
?>
<form name="qtty" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<table width="744" bgcolor="<? echo $dvd_table_bgcolor; ?>" border="0" cellspacing="1" cellpadding="1">
<tr><td class=\"style5\"></td><td class=\"style5\"><u>ID</td><td class=\"style5\"><u>Title</td><td class=\"style5\"><u>Order Type</td><td class=\"style5\"><u>Price</td><td class=\"style12\"></td><td class=\"style5\"><u>Qtty</td><td class=\"style12\"><u>Total</td><td class=\"style12\"></td></tr>
<?
if (isset($_POST['submit'])) {
$i = $POST['id'];
$q = $POST['qtty'];
if ($i) {
$query = " update items SET qtty = ('$q') WHERE id = $i";
$result = @($query);
} }
if (isset($_POST['submitdelete'])) {
$i = $_POST['id'];
if ($i) {
$query = " delete from items WHERE id = $i";
$result = @($query);
} }
$resultt = mysql_query("SELECT * FROM items WHERE userid=$userid");
$row = @mysql_fetch_assoc($resultt);
$dvd_id =$row[id];
$dvd_davisid =$row[davisid];
$dvd_title =$row[title];
$dvd_price =$row[price];
$dvd_qtty =$row[qtty];
$dvd_preorder =$row[preorder];
$subtotal = $dvd_qtty * $dvd_price;
$newsub = number_format($subtotal, 2, '.', ',');
$ordertype = $dvd_preorder;
if ($ordertype == "1") {
$dvd_preorder = "<font class=style3>*Pre Release</font>";
} ELSE {
$dvd_preorder = "Standard";
}
echo "<tr><td><input type=\"submit\" name=\"submitdelete\" value=\"X\"></td><td class=\"style5\">$dvd_davisid</td><td class=\"style5\">$dvd_title</td><td class=\"style5\">$dvd_preorder</td><td class=\"style5\">$dvd_price</td><td class=\"style12\">X</td><td class=\"style5\"><input type=\"hidden\" size=\"2\" name=\"id\" value=\"$row[id]\"><input type=\"text\" size=\"2\" name=\"qtty\" value=\"$dvd_qtty\" onfocus=\"if(this.value=='$dvd_qtty'){this.value=''}\" onblur=\"if(this.value==''){this.value='$dvd_qtty'}\"><input type=\"hidden\" name=\"submit\" value=\"\"></td><td class=\"style12\">\$ $newsub </td></tr>";
}
}
?>
<tr><td></td></tr>