taekwondokid42
New Member
- Messages
- 268
- Reaction score
- 0
- Points
- 0
I am having trouble with this script:
$quote_result = mysql_query("SELECT * FROM wiki_quotes ORDER BY $submit ASC");
while($quote_row = mysql_fetch_array($quote_result)){
echo "<p class = \"wiki_data\"> <tr><td>" .$quote_row['Quote']. "</td><td>" .$quote_row['Importance']. "</td><td>" .$quote_row['Submitted By']. "</td><td>" .$quote_row['Page']. "</td><td>" .$quote_row['Chapter']. "</td><td><input class = \"wiki_edit\" type = \"submit\" name = \"edit\" value = \"edit\"> <input readonly type = \"hidden\" name = \"hidden\" value = \"".$quote_row['id']."\"></td></tr></p>";
}
The focus here is <input readonly type = \"hidden\" name = \"hidden\" value = \"".$quote_row['id']."\">, because when I get to the submitted part of the form, and I print $_POST['hidden'], the value is always that of the last row retrieved by the loop.
I need the value of $_POST['hidden'] to equal that of the row which the variable was created.
Does anybody know how to do this without me changing the loop? (I need the loop to display all entries, even if some are added without the loop being changed)
$quote_result = mysql_query("SELECT * FROM wiki_quotes ORDER BY $submit ASC");
while($quote_row = mysql_fetch_array($quote_result)){
echo "<p class = \"wiki_data\"> <tr><td>" .$quote_row['Quote']. "</td><td>" .$quote_row['Importance']. "</td><td>" .$quote_row['Submitted By']. "</td><td>" .$quote_row['Page']. "</td><td>" .$quote_row['Chapter']. "</td><td><input class = \"wiki_edit\" type = \"submit\" name = \"edit\" value = \"edit\"> <input readonly type = \"hidden\" name = \"hidden\" value = \"".$quote_row['id']."\"></td></tr></p>";
}
The focus here is <input readonly type = \"hidden\" name = \"hidden\" value = \"".$quote_row['id']."\">, because when I get to the submitted part of the form, and I print $_POST['hidden'], the value is always that of the last row retrieved by the loop.
I need the value of $_POST['hidden'] to equal that of the row which the variable was created.
Does anybody know how to do this without me changing the loop? (I need the loop to display all entries, even if some are added without the loop being changed)