Jump to content

previous / next with forms


Ceramic Weasel

Recommended Posts

I found a nice script which allows me to pull results from a database and display them over multiple pages using a combination of 'LIMIT' in the MySQL query and tracking page numbers with PHP. And it worked great until i decided i wanted to add a checkbox form item for each displayed result, and track those as well.

The problem is, i don't know how to pass form data to the variable array without using a standard form submit, and i can't use those as the "previous" and "next" links because each one needs to have it's own 'page' value. Currently, they're constructed like this:

[code]if ($pageNum > 1) {
  $page = $pageNum - 1;
  $prev = " <a href=\"$self?keywords=$keywords&category=$category&page=$page\">[Prev]</a> - ";
  $first = " <a href=\"$self?keywords=$keywords&category=$category&page=1\">[First Page]</a> ";
} else {
  $prev  = " ";
  $first = " ";
}
if ($pageNum < $maxPage) {
  $page = $pageNum + 1;
  $next = " - <a href=\"$self?keywords=$keywords&category=$category&page=$page\">[Next]</a> ";
  $last = " <a href=\"$self?keywords=$keywords&category=$category&page=$maxPage\">[Last Page]</a> ";
} else {
  $next = " ";
  $last = " ";
}
[/code]

What i need is something that will allow me to move from page to page, carrying all those variables from the original search form, in addition to the new checkbox form data submitted on each page the user views.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.