I have a site that is like a holiday planner, at the moment you select which airport and what month you want to go on holiday. What I want it to do is to come back and allow you to select from a list of flights as to which one you want.
What I can only get it to do is to ask you to enter your flightno. and then it comes back and sees if there is a flight with that ID or not.
Hopefully someone can help.
There are two pages, the first is flightsearch, code is as follows:
Code: Select all
<?php
include ("connect.php");
startPage();
// title of page
echo '<form action="flightfind.php" method="get">';
echo "Please select your departure airport";
echo "<select name='Departure_Airport'>";
echo "<option value='EastMindlands'>EastMindlands</option>";
echo "<option value='Gatwick'>Gatwick</option>";
echo "<option value='Heathrow'>Heathrow</option>";
echo "<option value='Luton'>Luton</option>";
echo "</select>";
echo "<br/>";
$result = DoQuery("SELECT distinct Resort From hotel");
echo "Please select your destination airport ";
echo "<select name='Destination_Airport'>";
while($row = mysql_fetch_assoc($result)) {
echo "<option value='".$row['Resort']."'>".$row['Resort']."</option>";
}
echo "</select>";
echo "<br/>";
echo "Please select your departure date ";
echo "<select name='Departure_Month'>";
echo "<option value='01'> January </option>";
echo "<option value='02'> February</option>";
echo "<option value='03'> March</option>";
echo "<option value='04'> April</option>";
echo "<option value='05'> May</option>";
echo "<option value='06'> June</option>";
echo "<option value='07'> July</option>";
echo "<option value='08'> August</option>";
echo "<option value='09'> September</option>";
echo "<option value='10'> October</option>";
echo "<option value='11'> November</option>";
echo "<option value='12'> December</option>";
echo "</select>";
echo "<br>";
echo "Please select your returning date ";
echo "<select name='Return_Month'>";
echo "<option value='01'> January </option>";
echo "<option value='02'> February</option>";
echo "<option value='03'> March</option>";
echo "<option value='04'> April</option>";
echo "<option value='05'> May</option>";
echo "<option value='06'> June</option>";
echo "<option value='07'> July</option>";
echo "<option value='08'> August</option>";
echo "<option value='09'> September</option>";
echo "<option value='10'> October</option>";
echo "<option value='11'> November</option>";
echo "<option value='12'> December</option>";
echo "</select>";
?>
<br>
<input type="submit" value="Send">
</form>
<?php
endPage();
?>
The second page is flightfind:
Code: Select all
<?php
include('connect.php');
startPage();
$departAirport=$_GET['Departure_Airport'];
$destinationAirport=$_GET['Destination_Airport'];
$departureMonth=$_GET['Departure_Month'];
$returnMonth=$_GET['Return_Month'];
//get data from address bar- the above receives its information from the combo boxes on the previous page (flightsearch.php)
$departureMonth2 = "0"+($departureMonth+1);
echo "<p>Please select your out flight destination:</p>";
$query="SELECT * FROM `flight` WHERE DepartureAirport='$departAirport' AND DestinationAirport='$destinationAirport'".
" AND DepartureDate >= '2008-$departureMonth-01' AND DepartureDate < '2008-$departureMonth2-01'";
$result = DoQuery($query);
ShowQueryResult($result);
echo "<form action='flightresult.php' method='get'>";
echo "enter flight id: <input type='text' name='outflightid'>";
$returnMonth2 = "0"+($returnMonth+1);
echo "<p>Please select your return flight:</p>";
$query="SELECT * FROM `flight` WHERE DestinationAirport='$departAirport' AND DepartureAirport='$destinationAirport'".
" AND DepartureDate >= '2008-$returnMonth-01' AND DepartureDate < '2008-$returnMonth2-01'";
$result = DoQuery($query);
ShowQueryResult($result);
echo "enter flight id: <input type='text' name='returnflightid'>";
echo "<br><br><input type='submit'>";
echo "</form>";
endPage();
?>