Need some suggestion in a $_SESSION

I am trying to store values in page2.php from a form using POST in page1.php

is the set up below correct?

page2.php

 
 $strZipCode = isset($_REQUEST['frmSearch']['zipcode'])?$_SESSION['zipcode']= mysql_real_escape_string($_REQUEST['frmSearch']['zipcode']):'';

Above $strZipCode is equal to if zipcode is isset then $_SESSION zipcode equal escaped $_REQUEST from the form input zipcode field?

hope that set up is ready to use the SESSION value zipcode in pagination script in page2.php that will need the value of $StrZipCode variable value each time user navigate through the pages to display the content.

Why don’t you pass this variable via address bar, as suggested?

well that would be though get right?

the thing is that some of the input fields in the form are array types. How can I send them through the url then ?

easy
arr=value1&arr=value2

By using the same naming scheme you did in the form. Change your form to method=get to see it.

You should make use of http_build_query() if you need to dynamically construct or alter a query string though.

when I change the form method to get I am able to see the string.

I have set up one of the fields like

Form

to

page2.php


//here page2.php receives the values from form in page1.php 
$strName = isset($_REQUEST['frmSearch']['name'])?mysql_real_escape_string($_REQUEST['frmSearch']['name']):'';
    $strZipCode = isset($_REQUEST['frmSearch']['zipcode'])? mysql_real_escape_string($_REQUEST['frmSearch']['zipcode']):'';

Then it will query the fields state, zip and county if no empty $strZipCode

 if(!empty($strZipCode)){
  $query4 = "SELECT state, zip, county
FROM restaurants 
WHERE 
(zip= '$strZipCode') OR (state='$strState')" ; 
$result = mysql_query($query4);
$arrstate = mysql_fetch_array($result);
echo '<div class="information"><label>County:</label>
        <div>'. $arrstate['county']. '</div>
	  <label>State:</label>
             <div>'. $arrstate['state']. '</div>
		   <label>Zip Code:</label>
             <div>'. $arrstate['zip']. '</div></div> <br><br>';
			 }

Now my question how can I display the state, zip and county fields at the query above when only [‘frmSearch’][‘name’] is set

 isset($_REQUEST['frmSearch']['name']

right now it will only display if [‘frmSearch’][‘zip’] is set I would like to display the query above when name is only name is set. That’s why I was thinking on using SESSIONS…

Don’t have any idea where to star.

Sharpnel you have suggested to use the appended parameters of the GET method in the URL but what about when zip field is not provided it will show up an notice or error saying $strZipCode is undifined…

Well help.