I'm a fairly limited php user, so accept that I'm trying to hack through something that could be done more elegantly.
I've generated a list of rows thus:
- Code: Select all
$sql="select * from orders.ORDER where status = 'P'";
$result=mysql_query($sql) or die( "A MySQL error has occurred.<br />Your Query: " . $sql . "<br /> Error: (" . mysql_errno() . ") " . mysql_error());
$num=mysql_numrows($result);
echo "number_of rows $num";
$i=0;
echo "<table><tr width = 30%><td><b>Order ID</b></td><td width = 40%><b>Shelfmark</td><td width = 30%><b>Page Number</td></tr>";
while ($i < $num)
{
$order_id= mysql_result($result, $i, "id");
$shelfmark = mysql_result($result, $i, "shelfmark");
$page_no = mysql_result($result, $i, "pageno");
echo "<form method ='post' action = 'updateOrder.php'><tr><td><input type = text name = order_id size = 10 value= $order_id></td><td>$shelfmark</td><td>$page_no</td><td><input type = 'submit' value = 'update this order' name = 'button$i'></td></tr>";
$i++;
}
I thought if I made each row a form, with a button, I could pass the order id through to another page, where the order could be updated. It won't do that, as each button takes the value of order_id as it is (ie the last number)- I haven't attempted to do it using an array, as I assume I will hit the same problem with the counter value. Just wondering if anyone knows a (better) way to do this- I don't really want to use a dropdown for this.
Cheers
Scott

