Forum Moderators: coopster
In the code below, I'd like an existing variable called id to apear instead of XXXXX, but I can't seem to find the right way of doing it.
if ( $answer == $dbanswer){echo '<P>The answer you provided was correct, so you can continue authorized. Please <a href="page2.php?id=XXXXX">CLICK HERE<A> to continue.</P>';}
If I put id=$id, the link followed just says $id at the end rather than pasting the variable's value itself.
Any suggestions?
Now I have another problem. On the next page, I want to generate a list of questions specific to that id. In the code at the bottom, I expected to be able to add 'AND' but I get an error message
This doesn't work:
for($n = 0; $n <= $entries; $n++) {
$sql = "SELECT * FROM roam WHERE title = $n AND id= $id ";
This works:
for($n = 0; $n <= $entries; $n++) {
$sql = "SELECT * FROM roam WHERE title = $n";
Any suggestions?
for($n = 0; $n <= $entries; $n++) {
$sql = "SELECT * FROM quiz WHERE title = $n";
$result = mysql_query($sql);
while ($info = mysql_fetch_array($result)) {
foreach( $info AS $key => $val ) {
$$key = stripslashes( $val );
}
$options .= "<option value=\"$questions\">$questions</option>";
}
}
return $options;
}