$strName = isset($_REQUEST['frmSearch']['name'])?mysql_real_escape_string($_REQUEST['frmSearch']['name']):'';
$strZipCode = isset($_REQUEST['frmSearch']['zipcode'])? mysql_real_escape_string($_REQUEST['frmSearch']['zipcode']):'';
$strState = isset($_REQUEST['frmSearch']['zipcode'])?mysql_real_escape_string ($_REQUEST['frmSearch']['state']):'';/*)*/;
if(!empty($strZipCode)){
$query4 = "SELECT state, zip, county
FROM stores
WHERE
(zip= '$strZipCode');
$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>';
}
In the code above there is info $_RESQUESTed from a form coming from page1.php then it is use to display the fields County,State and zip from the table stores. as it is set up this fileds will display only WHERE (zip= ‘$strZipCode’); now it means that if a user select information from another fields and leave zipcode input fields empty the fields County,State and zip won’t display. Now how can I set the WHERE Clause to also display when users only input data in the state input field at the form in page1.php. Or only input data in the Name input field at the form in page1.php and leave the other iunput field of the form empty?
How that WHERE clause would look like ?
Help please…