Jump to content

Paginating issue


netfrugal

Recommended Posts

I have 2 pages.  Form.php  & Paginate.php

I enter the username into the form.php and it sends me over to paginate.php where it looks for records with the username I chose.

I can see all the results on Paginate.php, but if I click to go to the next page (paginate.php?page=2)  everything goes blank!

Do the search parameters get lost after one page? 

Any help would be appreciated!

thanks!
Link to comment
Share on other sites

[quote author=netfrugal link=topic=110978.msg449400#msg449400 date=1160417366]
Do the search parameters get lost after one page? 
[/quote]

Yes, unless you save them in a session variable, or pass them in the URL along with the page number (I think the second is probably preferable in your case).

Say your form submits with a URL like this:
[color=green]http://www.mydom.com/paginate.php?cat=shirts&sort=asc[/color]

Then the links in your paginate page should look a little like this:
[code=php:0]
echo <<<HTML
<a href="paginate.php?cat={$_GET['cat']}&sort={$_GET['sort']}&page={$i}">$i</a>
HTML;
[/code]

This would take you to the following url:
[color=green]http://www.mydom.com/paginate.php?cat=shirts&sort=asc&page=2[/color]

I've used heredoc syntax to escape the HTML above, if you're unaware of this, look it up here: [url=http://uk.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc]heredoc[/url]

Regards
Huggie
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.