Andrew R Posted August 20, 2006 Share Posted August 20, 2006 HelloI need some help on modifying my flight searcher. For example, I select Departure airport as “Miami”, arrival airport as “Dublin”, Aircraft as “Airbus A300” and day as “Sunday”. Once I press submit the form will go to viewroutes.php and display the routes that match the query above. The problem I’m having is the scripts below only allow for one query at a time i.e. I can only display routes on a Monday or any other day. I believe the problem is in the sql query on the viewroutes.php page. How would I modify it to allow a query like the one above?Here are the codes I’m using below.[code]<form action="viewroutes.php" method="post" name="day" id="day"> <table width="492" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="133" height="25" valign="middle" bgcolor="#CCCCCC">Departing From:</td> <td width="359" valign="top"><select name="dep" id="dep"> <option selected>Dublin</option> <option>Shannon</option> <option>Miami</option> </select> </td> </tr> <tr> <td height="24" valign="middle" bgcolor="#CCCCCC">Arrival:</td> <td valign="top"><select name="arr" id="arr"> <option selected>Dublin</option> <option>Shannon</option> <option>Miami</option> </select> </td> </tr> <tr> <td height="24" valign="top" bgcolor="#CCCCCC">Aircraft:</td> <td valign="top"><select name="aircraft" id="aircraft"> <option selected>Airbus A300</option> <option>Airbus A310</option> </select> </td> </tr> <tr> <td height="24" valign="top" bgcolor="#CCCCCC">Day:</td> <td valign="top"><select name="formquery" id="formquery"> <option selected>Sunday</option> <option>Monday</option> <option>Tuesday</option> <option>Wednesday</option> <option>Thursday</option> <option>Friday</option> <option>Saturday</option> </select> <input name="formtype" type="hidden" id="formtype" value="day"> </td> </tr> <tr> <td height="24"> </td> <td valign="top"><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td> </tr> </table> </form>[/code] (search.php)[code]$query_routes = "SELECT * FROM routes where $formtype like '$formquery'";[/code] (SQL query on viewroutes.php)Thanks Quote Link to comment Share on other sites More sharing options...
steinmag Posted August 21, 2006 Share Posted August 21, 2006 You have to include all filters in the sql query:$sql = "SELECT * FROM routes where dep = '$dep' && arr='$arr' && aircraft='$aircraft' && formquery like '$formquery'"; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.