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 !

I think this could be a possible option !

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.

My appraoch : (UpdateClientVendor.php)

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

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

What should the URL be?

$url = "clientvendor.php?filter1=$filtertype&filter2=$filterstatus";

Thanks for your help !

UpdateClientVendor.php

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

if(isset($_POST['Back']))
				{
				 header( 'Location: clientvendor.php?SelectType=$filtertype&SelectStatus=$filterstatus&Filter=true' ) ;
				}
			    ?>

Here SelectType and SelectStatus are two lists in clientvendor.php and Filter is the name of the button to click in order to filter the display !

But its still not working. Where is the problem? Is there some code to be included in clientvendor.php?

Please help me !

Aditi,

There is a number of ways to do this and your suggested method is probably the way I would do it.

It looks like you need two be able to accept parameters passed by $_POST and $_GET methods:

$_POST - For when a form is originally submitted (probably but not necessarily)
$_GET - For interpreting "back" button's url

You can use code like this to convert parameters to regular php variables, whilst allowing $_POST to override $_GET, in case there is a conflict:

<?php
// String params
$params = array('url' => 'u', 'title' => 't', 'action' => 'a');//hash of expected string parameters
while( list($var, $param) = @each($params) )
{
	if(isset($_POST[$param]) || isset($_GET[$param]))
	{
		$$var = (isset($_POST[$param]) ? htmlspecialchars($_POST[$param]) : htmlspecialchars($_GET[$param]);
	}
	else
	{
		$$var = '';
	}
}

// integer params
$params = array('uid' => 'uid', 'sid' => 'sid', 'itemid' => 'item');//hash of expected integer parameters
while( list($var, $param) = @each($params) )
{
	if(isset($_POST[$param]) || isset($_GET[$param]))
	{
		$$var = (isset($_POST[$param]) ? intval($_POST[$param]) : intval($_GET[$param]);
	}
	else
	{
		$$var = -1;
	}
}

// boolean params
$params = array('emailAlert' => 'email', 'cancel' => 'Cancel', 'submit' => 'Submit');//hash of expected boolean parameters
while( list($var, $param) = @each($params) )
{
	if(isset($_POST[$param]) || isset($_GET[$param]))
	{
		$$var = true;
	}
	else
	{
		$$var = false;
	}
}

?>

Airshow

I am still unable to go back to the searched criteria page using $_GET.

Can anyone give me a detailed description of how to do this relating it with my case? It would be of great help !

Aditi_19,

Build the back button's url as pritaeas says above and read parameters from $_GET and $_POST as I say above. Modify my code to read the parameters you are interested in (SelectType, SelectStatus, Filter), I can't give you the complete code because I don't know what the data types are (string|integer|boolean), but it is very easy to insert your parameters into my code, and to delete any of the code blocks that you don't use.

Airshow