how to go back to a php page keeping the search criteria?

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

Post Reply
aditi_19
Forum Newbie
Posts: 23
Joined: Sun Jun 21, 2009 3:09 pm

how to go back to a php page keeping the search criteria?

Post by aditi_19 »

I have a clientvendor.php file with various filters in it. This file directs to updateclientvendor.php file.

Now updateclientvendor.php has a Back button to go back to clientvendor.php . When the back button is pressed, I want the page to go back and display the filtered information which is not displayed when i use header( 'Location: clientvendor.php' ).

How can i store the contents of the filtered page when pressing back button !

I am filtering clientvendor.php based on 2 parameters : SelectType and SelectStatus. And then the user has to press Filter button to get the effect !

Please help me with this problem !
joeynovak
Forum Commoner
Posts: 26
Joined: Sun May 10, 2009 11:09 am

Re: how to go back to a php page keeping the search criteria?

Post by joeynovak »

You have a number of choices,

In updateClientVendor.php save the filters and modify the link of the back button to send the filters back to the previous page (on the URL as GET params, i.e. clientvendor.php?filter1=&filter2=) when they go back.

Save the filters to the session when they hit updateclientvendor.php, and write clientvendor.php to load the filters from the session when it is loaded.

Save the filters to cookies before going to updateclientvendor.php and restore them from the cookies when they go back (blech, not fun, not recommended, no reason to do it this way, but you can!)
aditi_19
Forum Newbie
Posts: 23
Joined: Sun Jun 21, 2009 3:09 pm

Re: how to go back to a php page keeping the search criteria?

Post by aditi_19 »

Thanks for your reply !

Could you elaborate a little bit on how to use this one - "In updateClientVendor.php save the filters and modify the link of the back button to send the filters back to the previous page (on the URL as GET params, i.e. clientvendor.php?filter1=&filter2=) when they go back."

How would the sample URL be?
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: how to go back to a php page keeping the search criteria?

Post by califdon »

aditi_19 wrote:Thanks for your reply !

Could you elaborate a little bit on how to use this one - "In updateClientVendor.php save the filters and modify the link of the back button to send the filters back to the previous page (on the URL as GET params, i.e. clientvendor.php?filter1=&filter2=) when they go back."

How would the sample URL be?
What was your question again???
aditi_19
Forum Newbie
Posts: 23
Joined: Sun Jun 21, 2009 3:09 pm

Re: how to go back to a php page keeping the search criteria?

Post by aditi_19 »

I mean how would be my URL in order to jump back to the filtered clientvendor.php page?

Say suppose i store it in this way:

UpdateClientVendor.php

$filtertype =$_POST['SelectType'];
$filterstatus =$_POST['SelectStatus'];

if(isset($_POST['Back']))
{
//URL ... So What should the URL be?
}
Post Reply