Approve button inside while loop

Hi…

I have form which data is inside while loop and per row has a approved button, Now I have no idea that when I click the approve button the JO # from that row will display and save to the database.

here is my code and sample form.


<?php
    error_reporting(0);
  date_default_timezone_set("Asia/Singapore"); //set the time zone
$con = mysql_connect('localhost', 'root','');

if (!$con) {
    echo 'failed';
    die();
}

mysql_select_db("mes", $con);
$Date_Shelve =date('Y-m-d H:i:s');
?>
<html>
<head>
<title>Sales Order</title>
<link rel="stylesheet" type="text/css" href="kanban.css" />
</head>
<body>
<form name="loading_kanban" action="" method="post">
<div id="SR_date">
<label>Date :</label>
<input type="text" name="Date_Shelve" id="Date_Shelve" value="<?php echo $Date_Shelve; ?>" size="16" readonly="readonly" style="border: none;">
</div>

<div id="kanban_table">
<table>
<th> JO No.</th>
<th> ETD </th>
<th> PO No. </th>
<th> SKU Code </th>
<th> Description </th>
<th> PO Req </th>
<th> Requirements </th>
<th> Priority</th>

<?php

$sql = "SELECT ETD, PO_No, SKUCode, Description, POReq
FROM sales_order";
$res_so = mysql_query($sql, $con);

while($row = mysql_fetch_assoc($res_so)){

$ETD = $row['ETD'];
$PO_No = $row['PO_No'];
$SKUCode = $row['SKUCode'];
$Description = $row['Description'];
$POReq = $row['POReq'];

echo "<tr>
<td>&nbsp;</td>
<td>$ETD</td>
<td>$PO_No</td>
<td>$SKUCode</td>
<td>$Description</td>
<td>$POReq</td>
<td>&nbsp;</td>
<td><input type='button' name='priority' value='Approved' id='priority'></td>
</tr>";
}


?>

</table>
</div>
</form>
</body>
</html>

What about something like this. It creates a form for each row of the table which will post back to the same page the PO # of the row to be updated. You can then check for that post value and update the appropriate value in the database.

<?php

$sql = "SELECT ETD, PO_No, SKUCode, Description, POReq
FROM sales_order";
$res_so = mysql_query($sql, $con);

while($row = mysql_fetch_assoc($res_so)){

$ETD = $row['ETD'];
$PO_No = $row['PO_No'];
$SKUCode = $row['SKUCode'];
$Description = $row['Description'];
$POReq = $row['POReq'];
?>
<tr>
	<td>&nbsp;</td>
	<td>$ETD</td>
	<td>$PO_No</td>
	<td>$SKUCode</td>
	<td>$Description</td>
	<td>$POReq</td>
	<td>&nbsp;</td>
	<td>
		<form action="" method="post">
			<input type="hidden" name="po_number" value="<?php echo $PO_No; ?>"  />
			<input type='submit' name='priority' value='Approved' id='priority'>
		</form>
	</td>
</tr>
<?php

}