Jump to content


Photo

previous / next with forms


  • Please log in to reply
2 replies to this topic

#1 Ceramic Weasel

Ceramic Weasel
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 28 April 2006 - 02:31 AM

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:

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 = " ";
}

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.

#2 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 28 April 2006 - 02:38 AM

can i see the page in action what you have so far? got a linkie?
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#3 Ceramic Weasel

Ceramic Weasel
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 28 April 2006 - 09:15 AM

I don't have it hosted anywhere yet. It's a bit like what Hotdockets does on their search results page, though I can't seem to get their Javascript solution to work. I'm not even sure it's possible to do with PHP.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users