Jump to content


Photo

Flight searcher


  • Please log in to reply
1 reply to this topic

#1 Andrew R

Andrew R
  • Members
  • PipPipPip
  • Advanced Member
  • 158 posts
  • LocationIreland

Posted 20 August 2006 - 03:43 PM

Hello

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

<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>
        &nbsp; </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"> &nbsp;</td>
    </tr>
    <tr> 
      <td height="24">&nbsp;</td>
      <td valign="top"><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td>
    </tr>
  </table>
 </form>
(search.php)

$query_routes = "SELECT * FROM routes where $formtype like '$formquery'";
(SQL query on viewroutes.php)

Thanks


#2 steinmag

steinmag
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 21 August 2006 - 01:51 PM

You have to include all filters in the sql query:

$sql = "SELECT * FROM routes where dep = '$dep' && arr='$arr' && aircraft='$aircraft' && formquery like '$formquery'";




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users