Forums

PHP

This topic is locked

query results pagination

Posted 03 Jan 2006 11:04:22
1
has voted
03 Jan 2006 11:04:22 mouli greenlaw posted:
Hi
My first post to this forum. Happy new year to all.
I have a form that sets up the parameters to query a database. This works great but i'd like to paginate the pages. I set this up using DW's server behaviours and it looks good except that when you click the link for the next page it seems to lose the original posted variables so reverts to the default values which messes up the search.
Any ideas would be greatly appreciated.

Replies

Replied 04 Jan 2006 09:18:52
04 Jan 2006 09:18:52 mouli greenlaw replied:
Well i found the solution on another forum.
Simply change the form action from POST to GET.
I dont understand why it works but it does. If any body could explain it to me I'd be interested
Replied 04 Jan 2006 15:09:21
04 Jan 2006 15:09:21 Roddy Dairion replied:
POST (in php) means u'r submitting details from a form (txtbox, dropdown etc...), so when u click on the "Submit" button it just POST all ur details.
GET works via links for e.g www.dmxzone.com/forum/topic.asp?topic_id=33645 . So what u've done is past a parameter into ur link which here will b "topic_id=33645"

So in pagination u'll will c that if u've reached for e.g. page 15 of 50 if you do anyfing else i.e. Submit new data or open a topic, etc... if you don't specify a parameter in ur link to come back to page 15 it will take u back to page 1. Usually i specify this page using link.php?page_no=.... or ?page=.... in the form action= tag or php header tag, this way a user will always come back to the page he/she was.

Hope it helps.
Roddy.


Reply to this topic