I'm new at this. I want to have a user choose from a displayed list & pass
the choice to another page. I've tried session variables, $_POST. I can send the displayed array pointer I want (requestoption), but not the data in
the chosen row9identbook[]). Thanks for your patience:)
for ($i=0; $i <$num_results; $i++)
{
$row = mysql_fetch_array($result);
$identbook[]=$row["bookid"];
echo "<p><strong>".($i+1).". Title: ";
echo stripslashes($row["title"]);
echo "</strong><br>Author: ";
echo stripslashes($row["author"]);
echo "<br>Genre: ";
echo $row["genre"];
echo " Format: ";
echo $row["format"];
echo " Condition: ";
echo $row["condition"];
}
echo "</p>";
}
?>
<form action="confirmation.php" method="post" >
<font face="Arial, Helvetica, sans-serif"><strong>Request
Option #:</strong></font>
<input type="hidden" name="identbook[]">
<input type="text" name="requestoption" maxlength=4 size=4>
<input type=submit name="Confirm" value="Confirm">
</form>
passing data re: POST ( I read the sticky!)
Moderator: General Moderators
I would suggest something like this..
This is just one way of doing it. Each row in your result generates a link. The meat of the link is the processing script, and the book ID number, all the rest is display. Of cource, your target script needs to be able to handle info coming at in in GET rather than POST.
You could also use checkboxes or radiobuttons. Each one gets the same name, but the appropriate id value. I think radiobuttons limit to one selected, but you'd want to check. Then, I think only the selected one will get POST'ed to your script.
I hope that helps, and maybe makes sense..
Code: Select all
for ($i=0; $i <$num_results; $i++)
{
$row = mysql_fetch_array($result);
echo "<A href = 'confirmation.php?identbook=";
echo $rowї"bookid"] . "'>";
echo "<p><strong>".($i+1).". Title: ";
echo stripslashes($rowї"title"]);
echo "</strong></A><br>";
echo "Author: ";
echo stripslashes($rowї"author"]);
echo "<br>Genre: ";
echo $rowї"genre"];
echo " Format: ";
echo $rowї"format"];
echo " Condition: ";
echo $rowї"condition"];
}You could also use checkboxes or radiobuttons. Each one gets the same name, but the appropriate id value. I think radiobuttons limit to one selected, but you'd want to check. Then, I think only the selected one will get POST'ed to your script.
I hope that helps, and maybe makes sense..
I'll try that
thanks, Hurkle. That's an approach I never thought of.