Enable users to change information that's echo'ed from loop
Posted: Wed May 27, 2009 10:36 am
I'm trying to create a loop that will list all the information within a part of a mysql table, while including a form that will allow them to change the value in a field and save those changes to the table.
I'm not sure about how to post this information after the user has entered the changes.
Here's what I have so far.
I'm not sure about how to post this information after the user has entered the changes.
Here's what I have so far.
Code: Select all
<?php
// Make a MySQL Connection
include_once "../scripts/connect_to_mysql.php";
// Create a page with the specified table info
$store = "4071";
$local = "WF";
$query = "SELECT * FROM Inventory$store WHERE local='$local'";
$result = mysql_query($query) or die(mysql_error());
echo "<table border=\"1\" align=\"center\">";
echo "<tr><th>Product ID</th>";
echo "<th>Description</th>";
echo "<th>Quantity</th>";
echo "<th>Case</th>";
echo "<th>case</th></tr>";
while($row = mysql_fetch_array($result)){
extract($row);
echo "<tr><td>";
echo $row['fomez'];
echo "</td><td>";
echo $row['desc'];
echo "</td><td>";
echo $row['quant'];
echo "</td><td>";
echo $row['case'];
echo "</td><td>";
echo "<input type='text' method='post' value='$case'></form>\n";
//echo "";
echo "</td></tr>";
}
echo "</table>";
echo "<input type='submit' value='Continue to the next step.'></form>\n";
?>