Okay, Rob, we need to step back and go over the basics…
First, normally, you create a HTML page with a FORM on it. This is full of whatever FIELDS you need.
Then, you create a second page, a PHP version. This takes the FIELDS posted from the first page and does whatever calculations that are needed and usually redirects to a second HTML/or/PHP page that does the
next part of the project…
So, your first posts shows a redirect inside a page of HTML with PHP… This can be done, but, not the way you have it coded.
The second version shows no redirect and no ACTION in the FORM. So, this page will just “POST” to itself…
If the page posts to itself, it can not go anywhere except itself.
Lastly, this code:
[php]
// Check if button name “Submit” is active, do this
if (isset($_POST[‘Submit’])){
for($i=0;$i<$count;$i++)
{
$sql="UPDATE Prod SET model=$model[$i]
, name=$name[$i]
, description=$description[$i]
,
length_oa=’$length_oa[$i]’ , length_blade=’$length_blade[$i]’ ,
blade_spine=’$blade_spine[$i]’ , length_handle=’$length_handle[$i]’ , weight=’$weight[$i]’ ,
steel=’$steel[$i]’ , status=’$status[$i]’ WHERE id=’$id[$i]’ ";
$result=mysql_query($sql) or die(mysql_error());
}
}
$sql=“SELECT * FROM Prod WHERE manufacturer_id=‘6’ ORDER BY model”;
// $sql=“SELECT * FROM Prod WHERE id=‘113’ ORDER BY model”;
$result=mysql_query($sql);
[/php]
So, if you look at that code, you will see that if the form is submitted, it does a query and then the next thing it does is another query, so the first query never actually does anything. If the form is submitted, the QUERY for that part never happens… You would have to change this to something like this:
[php]
// Check if button name “Submit” is active, do this
if (isset($_POST[‘Submit’])){
for($i=0;$i<$count;$i++)
{
$sql="UPDATE Prod SET model=$model[$i]
, name=$name[$i]
, description=$description[$i]
,
length_oa=’$length_oa[$i]’ , length_blade=’$length_blade[$i]’ ,
blade_spine=’$blade_spine[$i]’ , length_handle=’$length_handle[$i]’ , weight=’$weight[$i]’ ,
steel=’$steel[$i]’ , status=’$status[$i]’ WHERE id=’$id[$i]’ ";
$result=mysql_query($sql) or die(mysql_error());
}
}else{
$sql=“SELECT * FROM Prod WHERE manufacturer_id=‘6’ ORDER BY model”;
// $sql=“SELECT * FROM Prod WHERE id=‘113’ ORDER BY model”;
$result=mysql_query($sql);
}
[/php]
So, you will see that this minor change, adding the ELSE clause does one query if the form is submitted and the other if it is not submitted. But, you should rethink exactly what you are trying to do. Eventually, you will want to go somewhere else with this page instead of just reposting back to itself. So, we can help get you sorted out, but, where are you heading with it? Good luck, hope this helps you a bit…