I want it so that the user can change any input box data and click on the one button and it update the records to each correct field based on their own unique id.
Here is the code for the front end
<form action="chstarterprice.php" method="post">
<br><br>
<?php
include("connection.php");
$result= mysql_query("SELECT title, subtext, nameid, category, price FROM starters");
while($row = mysql_fetch_array($result))
{
$nameid = $row['nameid'];
$title = $row['title'];
$subtext = $row['subtext'];
$category = $row['category'];
$price = $row['price'];
echo"<table>";
echo"<tr>";
echo"<td width=\"70px\">";
echo"<p class=\"form2\">";
echo "<b>Title</b>";
echo"</td>";
echo"<td width=\"120px\">";
echo"<p class=\"form2\">";
echo "<b>Subtext</b>";
echo"</td>";
echo"<td width=\"80px\">";
echo"<p class=\"form2\">";
echo "<b>Category</b>";
echo"</td>";
echo"<td width=\"80px\">";
echo"<p class=\"form2\">";
echo "<b>Price</b>";
echo"</td>";
echo"</tr>";
echo"<tr>";
echo"<td width=\"120px\">";
echo"<p class=\"form2\">";
echo"<input type=\"text\" name=\"$nameid\" value=\"$title\">";
echo"</td>";
echo"<td width=\"80px\">";
echo"<p class=\"form2\">";
echo"<input type=\"text\" name=\"$nameid\" value=\"$subtext\">";
echo"</td>";
echo"</td>";
echo"<td width=\"80px\">";
echo"<p class=\"form2\">";
echo"<input type=\"text\" name=\"$nameid\" value=\"$category\">";
echo"</td>";
echo"<td width=\"120px\">";
echo"<p class=\"form2\">";
echo"<input type=\"text\" name=\"$nameid\" value=\"$price\">";
echo"</td>";
echo"</tr>";
echo"<tr>";
echo"</tr>";
echo"</table>";
}
mysql_close($con); ?>
<br>
<input name="Submit" type="submit" value="Change" /></p>
</form>
Here is the backend script that processes the form data
<? ob_start(); ?>
<?php
include("connection.php");
$nameid = $_POST['nameid'];
$query = "update starters set title, subtext, nameid, category, price = ('$_POST[nameid]') where 'starters'.'nameid' = '$nameid' or die(mysql_error)";
if(mysql_query($query)){
header("location:change-prices.php");}
else{
header("location:change-prices.php");}
?>
<? ob_flush(); ?>
If you guys can point me in the right direction with the code to make this work I would be greatly appreciated, I am really sure that it has something to do with the backend script as opposed to the front end.
Please get back to me, thanks guys.
Mitch












