PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
JC2710
Forum Newbie
Posts: 6 Joined: Sun May 03, 2009 11:11 am
Post
by JC2710 » Thu May 14, 2009 3:47 am
Hi
I have a page that submits a form that returns paged results.
This works for the first page but when I click on page 2 nothing is displayed.
I think it has to do with my form and the action. At the moment I have:
Code: Select all
<form name="Search" method="post" action="search.php?go" id="searchform">
and further down I have:
Code: Select all
if(isset($_GET['go'])){.............
Is this correct?
Thanks
Yossarian
Forum Contributor
Posts: 101 Joined: Fri Jun 30, 2006 4:43 am
Post
by Yossarian » Thu May 14, 2009 4:24 am
Use var_dump( $_GET ) when you cannot figure out what your postback form interprets data as.
JC2710
Forum Newbie
Posts: 6 Joined: Sun May 03, 2009 11:11 am
Post
by JC2710 » Thu May 14, 2009 4:35 am
That gives me:
Code: Select all
array(1) { ["page"]=> string(1) "2" }
??
Yossarian
Forum Contributor
Posts: 101 Joined: Fri Jun 30, 2006 4:43 am
Post
by Yossarian » Thu May 14, 2009 5:26 am
Well that means you have a form element called "page" in your form and you picked an item with the value "2".
See, it did not recognise ?go because that has no value, and is therefore not set.
/?go=yes&page=2
Is what you are after, or maybe its just plain: /?go=2
It might be better if you explain what you are trying to achieve, moving to different pages depending on form submission or maybe just clean urls?
JC2710
Forum Newbie
Posts: 6 Joined: Sun May 03, 2009 11:11 am
Post
by JC2710 » Thu May 14, 2009 6:31 am
OK
Thanks for your help!
I think ive solved problem!
Thanks