Hello friends, I have list of items(products) in my database, and i echo them on my catalogue page, when you click on an item you will have to come back to the catelogue page before you can click on the next item. pls how do i script a link (NEXT or PREVIOUS) so that when the visitor can click on NEXT botton in order to see the detail of the next item without first going back to the catelogue page? (Eg when reading a message in your Yahoo, Gmail or Hotmail inbox, you can move to the next message by clicking on next without going back to your INBOX).
Pls I need the syntax.
regards
adsegzy
How to create next botton
Moderator: General Moderators
-
cpetercarter
- Forum Contributor
- Posts: 474
- Joined: Sat Jul 25, 2009 2:00 am
Re: How to create next botton
Other people may have much better ideas, but this is the procedure which occurs to me. I assume that your catalogue items all have unique ids. I guess too that it would be wrong to assume that the items displayed on the page will necessarily have neatly sequential ids . So, when your script identifies which items to display on a page, it could make an array of the unique ids of the items. Store this array as a session variable. On your catalogue page, I guess that you have a set of forms for each item. In each form, include a hidden field containing the array index associated with the item concerned. When a user presses the "next" button, the script could increment the index and find the unique id of the next item to display on the page.