post forms in loops
Posted: Tue Nov 04, 2003 10:47 pm
i'm very new to php and i'm having trouble with getting a form to be made in a loop. i've played around with the code and so it may be in shambles right now, but i think you'll get the idea from this
while($obj=mysql_fetch_object($result))
{
//other code that's not part of the problem
echo "<td>
<font color=\"white\" size=\"3\">Rate this File</font>
<form action=\"<?php echo $PHP_SELF ?>\" method=\"post\">
<select name=\"arating\">
<option value=\"1\">1
<option value=\"2\">2
<option value=\"3\">3
<option value=\"4\">4
<option value=\"5\">5
</select>
<input type=\"submit\" name=\"Submit\" value=\"Submit\" >
</form>
</td></tr>
</table>";
if ( $REQUEST_METHOD == 'POST' )
{
InsertRecord($arating,$file);
}
$file=$obj->filename;
}
now when i do this the page comes up ok, but when i try to submit an entry from the drop down box it gives me a 404 error saying that http://www.ipwnj00.net/<?php%20echo%20/ ... ds.php3%20?> can't be found. i've taken it out of the loop, and it submits it to the database, but then the form obviously isn't included with all the rows that i need. it also can't refresh without resending the information. like i said i'm really really new to php so any help would be appreciated.
while($obj=mysql_fetch_object($result))
{
//other code that's not part of the problem
echo "<td>
<font color=\"white\" size=\"3\">Rate this File</font>
<form action=\"<?php echo $PHP_SELF ?>\" method=\"post\">
<select name=\"arating\">
<option value=\"1\">1
<option value=\"2\">2
<option value=\"3\">3
<option value=\"4\">4
<option value=\"5\">5
</select>
<input type=\"submit\" name=\"Submit\" value=\"Submit\" >
</form>
</td></tr>
</table>";
if ( $REQUEST_METHOD == 'POST' )
{
InsertRecord($arating,$file);
}
$file=$obj->filename;
}
now when i do this the page comes up ok, but when i try to submit an entry from the drop down box it gives me a 404 error saying that http://www.ipwnj00.net/<?php%20echo%20/ ... ds.php3%20?> can't be found. i've taken it out of the loop, and it submits it to the database, but then the form obviously isn't included with all the rows that i need. it also can't refresh without resending the information. like i said i'm really really new to php so any help would be appreciated.