...

View Full Version : Approve button inside while loop



newphpcoder
04-19-2012, 09:58 AM
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>

tangoforce
04-19-2012, 12:46 PM
So what is the question?

Dormilich
04-20-2012, 06:48 AM
but you are aware that all PHP runs before the HTML is sent to the browser and when you have the page in the browser you cannot execute PHP?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum