How should i display an error message if both the drop down menus returns empty string.. and it should not display all results by default too..
First of all, there should be a message "please enter a search" before the user does a search. Next, it should display an error message when both the drop down menus couldn't return no results..
What is wrong with these codes? Why is it that only the first drop down search return results after i had the codes in..
Setting the error messages
// check for an empty string and display a message.
if ($_GET['AircraftType']== "") {
$resultmsg = "<p>Search Error</p><p>Please enter a search...</p>" ;
}
// check for a search parameter
if (!isset($_GET['AircraftType'])){
$resultmsg = "<p>Search Error</p><p>We don't seem to have a search parameter! </p>" ;
}
// check for an empty string and display a message.
if ($_GET['ServicingType']== "") {
$resultmsg = "<p>Search Error</p><p>Please enter a search...</p>" ;
}
// check for a search parameter
if (!isset($_GET['ServicingType'])){
$resultmsg = "<p>Search Error</p><p>We don't seem to have a search parameter! </p>" ;
}
if( isset ($resultmsg))
{
echo $resultmsg;
exit();
}
else{
echo "<b><font color = \"RED\">Search Results</font></b><br>";
if (!empty($_GET['AircraftType']))
{
echo "<b>Aircraft Type: " .$_GET['AircraftType']."</b><br>";
}
if (!empty($_GET['ServicingType']))
{
echo "<b>ServicingType: " .$_GET['ServicingType']."</b><br>";
}
$queryAircraftDisplay = "SELECT * from report where 1";
if (!empty($_GET['AircraftType']))
{
$queryAircraftDisplay .= " and aircraftType='".$_GET['AircraftType']."' ";
}
if (!empty($_GET['ServicingType']))
{
$queryAircraftDisplay .= " and servicingType='".$_GET['ServicingType']."' ";
}
}