Jump to content

Next and Previous button


gaya

Recommended Posts

Hi, Please any1 tell how to set the previous button. For eg if i'm writing an exam in online and i'm viewing the questions one by one. If i viewed the first question i'll press the next button to view the 2nd question.Bt if i again want to view the 1st question means i've to click the previous button. I dnt knw how to set the previous button. Please any one tell me how to do this.

Link to comment
Share on other sites

I guess you could use sessions atleast. Example if session doesnt exist

if (!isset($_SESSION['currentquestion'])) {$_SESSION['currentquestion'] = 0;}

And each next button press = session + 1 and store data with sessions also i guess. Also jQuery might do this, but im not quite sure how-to. (I guess jQuery would also be more user-friendly and better)

Edited by Mudsaf
  • Like 1
Link to comment
Share on other sites

Instead of using browser button for interactivity of your application you should use html markup to create the next previous button. you can append the question number or id in each next or previous link. each time a page is loaded you can manipulate next and previous button id/number from the current page and then you can print it dynamically. previous page will never be less than 1 and next link will not be greater than total questions or highest question id ("Depening upon implementation of your application)

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...