move to next record

Results 1 to 2 of 2

Thread: move to next record

  1. #1
    Join Date
    Dec 1969

    Default move to next record

    hi!<BR><BR>i have a page with different text boxes that are filled with records from a DB (several tables). i need the user to be able to move to the next record by pressing a button.<BR><BR>can you help me with this? point me to a place or something?<BR><BR>thanks!

  2. #2
    Join Date
    Dec 1969

    Default Just make the buttons normal...

    ...submit buttons, so that the form get submitted back to the same page. Then at the beginning of the page you can check which button was pressed, because its value will have been submitted and then increase or decrease a counter (held in a session variable or in a hidden field on the page) that tells you which record number to display. Then you just need to get the record details out of the DB and put them in the text boxes, as usual - no tricks here.<BR><BR>The only exception is the very first time the user gets to the page. In this case neither of the submit buttons (next or previous) will have been pressed, so neither will have been submitted to the page. You can check for this and treat it as the special case where you initialise the counter to 1 (i.e. first record). The rest should be the same.<BR><BR>The whole thing would be something like this:<BR><BR>1) Is next button submitted? Increase counter by one.<BR>2) Else, is previous button submitted? Decrease counter by one.<BR>3) Else neither were pressed, so set counter to 1.<BR>4) Get record details from database and put them in text boxes.<BR>5) If this is NOT the first record, output the previous button.<BR>6) If this is NOT the last record, output the next button.<BR>7) Output a hidden field with the counter value, or put counter value into a session variable.<BR><BR>Oliver.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts