Gez
05-14-2008, 03:13 PM
Ok, my code is below but i can't seem to get anything thats going on in the functions ShowRetFlights and ShowDepFlights to appear/work i think it might be something to do with the sessions but im not sure. Also if anyone knows, how should i go about getting the text boxes in the form to keep the vale that was typed in before pressing the submit button?
Thanks in advance
<style type="text/css">
<!--
body {
background-image: url(bg.jpg);
text-align: center
}
body,td,th {
font-family: Arial, Helvetica, sans-serif;
}
h1 {
font-size: xx-large;
}
-->
</style>
<?php
session_start();
Include ("dbconnect.php");
Function form(){
echo "
<form action='".$_SERVER['PHP_SELF']."' method='GET'>
<table align='center' width='200' border='0'>
<tr>
<td align='center'>Destination:</td>
<td align='center'>Flying from:</td>
</tr>
<tr>
<td><input name='destination' type='text'></td>
<td><input name='flyfrom' type='text'></td>
</tr>
<tr>
<td align='center'>Date (YYYY-MM-DD)</td>
<td align='center'>Date (YYYY-MM-DD)</td>
</tr>
<tr>
<td><input name='depdate' type='text'></td>
<td><input name='retdate' type='text'></td>
</tr>
<tr>
<td colspan='2' align='center'><input type='submit' value='Take me there!'></td>
</tr>
</table>
</form>";
}
Function ShowRetFlights (){
// Set Sessions
$DestinationName=$_REQUEST['destination'];
$FlyingFrom=$_REQUEST['flyfrom'];
$RetDate=$_REQUEST['retdate'];
// Do the query
$resultret = mysql_query("SELECT * FROM $table_flight
WHERE DestinationAirport ='".$FlyingFrom."'
AND DepartureDate ='".$RetDate."'
AND DepartureAirport ='".$DestinationName."'");
return ($resultret);
echo " <b> INBOUND flights </b> <br/><br/>
<table align='center' width='200' border='0'>
<tr>
<td align='center'>Destination: </td>
<td align='center'>Airline:</td>
<td align='center'>Departure Airport:</td>
<td align='center'>Departure Date:</td>
<td align='center'>Departure Time:</td>
<td align='center'>Cost:</td>
<td align='center'></td>
</tr>";
// Display the results
while ($row = mysql_fetch_array( $resultret )){
echo "<tr>";
echo " <td align='center'>".$row['DestinationAirport']."</td>";
echo " <td align='center'>".$row['Airline']."</td>";
echo " <td align='center'>".$row['DepartureAirport']."</td>";
echo " <td align='center'>".$row['DepartureDate']."</td>";
echo " <td align='center'>".$row['DepartureTime']."</td>";
echo " <td align='center'>".$row['Fare']."</td>";
echo " <td align='center'></td>";
echo " </tr>";
}
echo "</table><br/><hr><br>/";
}
Function ShowDepFlights (){
$table_flight="flight";
// Set Sessions
$DestinationName=$_REQUEST['destination'];
$DepDate=$_REQUEST['depdate'];
$FlyingFrom=$_REQUEST['flyfrom'];
$RetDate=$_REQUEST['fretdate'];
// Do the query
$resultdep = mysql_query("SELECT * FROM $table_flight
WHERE DestinationAirport ='".$DestinationName."'
AND DepartureDate ='".$DepDate."'
AND DepartureAirport ='".$FlyingFrom."'");
return ($resultdep);
echo " <b> OUTBOUND flights </b> <br/><br/>
<table width='200' border='1'>
<tr>
<td align='center'>Destination: </td>
<td align='center'>Airline:</td>
<td align='center'>Departure Airport:</td>
<td align='center'>Departure Date:</td>
<td align='center'>Departure Time:</td>
<td align='center'>Cost:</td>
<td align='center'></td>
</tr>";
// Display the results
while ($row = mysql_fetch_array( $resultdep )){
echo "<tr>";
echo " <td align='center'>".$row['DestinationAirport']."</td>";
echo " <td align='center'>".$row['Airline']."</td>";
echo " <td align='center'>".$row['DepartureAirport']."</td>";
echo " <td align='center'>".$row['DepartureDate']."</td>";
echo " <td align='center'>".$row['DepartureTime']."</td>";
echo " <td align='center'>".$row['Fare']."</td>";
echo " <td align='center'></td>";
echo " </tr>";
}
echo "</table><br/><hr><br>/";
}
echo "
<html>
<head>
<title> Lufbra Travel </title>
</head>
<body>
<h1>Lufbra Travel</h1> ";
form();
ShowDepFlights();
ShowRetFlights();
echo "
<hr><br/>
© Geraint Fisher 2008
</body>
</html> ";
?>
Thanks in advance
<style type="text/css">
<!--
body {
background-image: url(bg.jpg);
text-align: center
}
body,td,th {
font-family: Arial, Helvetica, sans-serif;
}
h1 {
font-size: xx-large;
}
-->
</style>
<?php
session_start();
Include ("dbconnect.php");
Function form(){
echo "
<form action='".$_SERVER['PHP_SELF']."' method='GET'>
<table align='center' width='200' border='0'>
<tr>
<td align='center'>Destination:</td>
<td align='center'>Flying from:</td>
</tr>
<tr>
<td><input name='destination' type='text'></td>
<td><input name='flyfrom' type='text'></td>
</tr>
<tr>
<td align='center'>Date (YYYY-MM-DD)</td>
<td align='center'>Date (YYYY-MM-DD)</td>
</tr>
<tr>
<td><input name='depdate' type='text'></td>
<td><input name='retdate' type='text'></td>
</tr>
<tr>
<td colspan='2' align='center'><input type='submit' value='Take me there!'></td>
</tr>
</table>
</form>";
}
Function ShowRetFlights (){
// Set Sessions
$DestinationName=$_REQUEST['destination'];
$FlyingFrom=$_REQUEST['flyfrom'];
$RetDate=$_REQUEST['retdate'];
// Do the query
$resultret = mysql_query("SELECT * FROM $table_flight
WHERE DestinationAirport ='".$FlyingFrom."'
AND DepartureDate ='".$RetDate."'
AND DepartureAirport ='".$DestinationName."'");
return ($resultret);
echo " <b> INBOUND flights </b> <br/><br/>
<table align='center' width='200' border='0'>
<tr>
<td align='center'>Destination: </td>
<td align='center'>Airline:</td>
<td align='center'>Departure Airport:</td>
<td align='center'>Departure Date:</td>
<td align='center'>Departure Time:</td>
<td align='center'>Cost:</td>
<td align='center'></td>
</tr>";
// Display the results
while ($row = mysql_fetch_array( $resultret )){
echo "<tr>";
echo " <td align='center'>".$row['DestinationAirport']."</td>";
echo " <td align='center'>".$row['Airline']."</td>";
echo " <td align='center'>".$row['DepartureAirport']."</td>";
echo " <td align='center'>".$row['DepartureDate']."</td>";
echo " <td align='center'>".$row['DepartureTime']."</td>";
echo " <td align='center'>".$row['Fare']."</td>";
echo " <td align='center'></td>";
echo " </tr>";
}
echo "</table><br/><hr><br>/";
}
Function ShowDepFlights (){
$table_flight="flight";
// Set Sessions
$DestinationName=$_REQUEST['destination'];
$DepDate=$_REQUEST['depdate'];
$FlyingFrom=$_REQUEST['flyfrom'];
$RetDate=$_REQUEST['fretdate'];
// Do the query
$resultdep = mysql_query("SELECT * FROM $table_flight
WHERE DestinationAirport ='".$DestinationName."'
AND DepartureDate ='".$DepDate."'
AND DepartureAirport ='".$FlyingFrom."'");
return ($resultdep);
echo " <b> OUTBOUND flights </b> <br/><br/>
<table width='200' border='1'>
<tr>
<td align='center'>Destination: </td>
<td align='center'>Airline:</td>
<td align='center'>Departure Airport:</td>
<td align='center'>Departure Date:</td>
<td align='center'>Departure Time:</td>
<td align='center'>Cost:</td>
<td align='center'></td>
</tr>";
// Display the results
while ($row = mysql_fetch_array( $resultdep )){
echo "<tr>";
echo " <td align='center'>".$row['DestinationAirport']."</td>";
echo " <td align='center'>".$row['Airline']."</td>";
echo " <td align='center'>".$row['DepartureAirport']."</td>";
echo " <td align='center'>".$row['DepartureDate']."</td>";
echo " <td align='center'>".$row['DepartureTime']."</td>";
echo " <td align='center'>".$row['Fare']."</td>";
echo " <td align='center'></td>";
echo " </tr>";
}
echo "</table><br/><hr><br>/";
}
echo "
<html>
<head>
<title> Lufbra Travel </title>
</head>
<body>
<h1>Lufbra Travel</h1> ";
form();
ShowDepFlights();
ShowRetFlights();
echo "
<hr><br/>
© Geraint Fisher 2008
</body>
</html> ";
?>