开发者

Loop through a php page until session reaches a certain value

开发者 https://www.devze.com 2023-02-24 05:31 出处:网络
I am currently developing a web based examination. all the question and answers are save on mysql database. I started the system by retrieving and displaying one question together with the answers whi

I am currently developing a web based examination. all the question and answers are save on mysql database. I started the system by retrieving and displaying one question together with the answers which is on radio type. i used a session $_SESSION['questionno']=1; to indicate on what question number will be retrieved and displayed. what i want to do next is that whenever the user clicks the next button it will forward informations to result.php and then the said page will add into the session the answer that was retrieved from the previous page at the same time result.php will increment the $_SESSION['questionno']; and then use

echo ("<SCRIPT LANGUAGE='JavaScript'> window.location='/OE/index.php'; </SCRIPT>");

to go back to the questions page (index.php) but this time question number two will be displayed because of the incrementation that happened in result.php.

after a series of loops and the user reaches the last开发者_JAVA百科 question a tally page will then appear.


To do this, I would combine the question page, and the result page. First display the first question (if the session isn't set then set it to 1). Then when the question is submitted to itself, you would process and put that info into the database, then add 1 to the session variable, then run the processing to display the next question form (based on the previously set session).

If you want to do it your way, then look at header('Location: index.html'); in the php manual (here).

0

精彩评论

暂无评论...
验证码 换一张
取 消