VAR5AN1 Posted April 13, 2006 Share Posted April 13, 2006 we have initialised the session which does work...We have initialised $ques = 1 so that it displays the first question stored from the database.ok..the exact problem we encounter is that when the user clieck on next question buttonit should remember the first question using session and the $ques should increment by 1 so that it goes to the next question using the same form and retriving the next question from the database..the snippet code we have$ques = 1; $sql = "select * from question where QuestionID = $ques"; $rs=mysql_query($sql, $conn) or die( "Could not execute query" ); do { while ($row = mysql_fetch_array($rs)) { echo ("<form action=\"?=SID?\" method=\"post\" >"); echo ("Question $ques: " . $row["Question"]."<br><br>"); echo ("<input type=\"radio\" name=\"Answer\" value=>".$row["Answer1"]."<br>"); echo ("<input type=\"radio\" name=\"Answer\" value=>".$row["Answer2"]."<br>"); echo ("<input type=\"radio\" name=\"Answer\" value=>".$row["Answer3"]."<br>"); echo ("<input type=\"radio\" name=\"Answer\" value=>".$row["Answer4"]."<br><br>"); echo ("<input type=\"submit\" value=\"Next Question\""); echo ("</form>"); } $ques++; }i dont know if do loop will be appropriate for the loopthank u 4 ur help Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.