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.
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…