Airway Reservation System

9
AIRWAY RESERVATION SYSTEM CODING: 1. Index.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Airway Reservation System</title> <style type="text/css">  body {  background-image:url( 'airplane.jpg');  background-repeat: no-repeat;  background-attachment :fixed;  background-positio n:center; } </style> </head> <body> <p style="text-align:center; color:red; font-size:18px ">Airline Reservarion System</p> <form action="index.php" method="post" name="reserv"> <table width="453" height="155" border="0"> <tr> <th width="218" scope="row">Enter Source Station :</th> <td width="174"><label for="src_list"></label> <select name="src_list" id="src_list"> <option value="select" selected="selected">Select Your Stn</option> <option value="cbe">Coimbatore</option> <option value="chn">Chennai</option> <option value="goa">Goa</option> <option value="blr">Bangalore</option> </select></td> </tr> <tr> <th scope="row">Enter Destination Station :</th> <td><select name="dest_list" id="dest_list"> <option value="select" selected="selected">Select Your Stn</option> <option value="cbe">Coimbatore</option> <option value="chn">Chennai</option> <option value="goa">Goa</option> <option value="blr">Bangalore</option> </select></td> </tr> <tr>

Transcript of Airway Reservation System

Page 1: Airway Reservation System

7/28/2019 Airway Reservation System

http://slidepdf.com/reader/full/airway-reservation-system 1/8

AIRWAY RESERVATION SYSTEM

CODING:

1. Index.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Airway Reservation System</title><style type="text/css">

 body{

 background-image:url('airplane.jpg'); background-repeat:no-repeat; background-attachment:fixed; background-position:center;}

</style></head>

<body><p style="text-align:center; color:red; font-size:18px

">Airline Reservarion System</p><form action="index.php" method="post" name="reserv"><table width="453" height="155" border="0"><tr>

<th width="218" scope="row">Enter Source Station :</th><td width="174"><label for="src_list"></label><select name="src_list" id="src_list">

<option value="select" selected="selected">Select Your Stn</option><option value="cbe">Coimbatore</option><option value="chn">Chennai</option><option value="goa">Goa</option>

<option value="blr">Bangalore</option></select></td>

</tr><tr>

<th scope="row">Enter Destination Station :</th><td><select name="dest_list" id="dest_list"><option value="select" selected="selected">Select Your Stn</option><option value="cbe">Coimbatore</option><option value="chn">Chennai</option><option value="goa">Goa</option><option value="blr">Bangalore</option>

</select></td></tr><tr>

Page 2: Airway Reservation System

7/28/2019 Airway Reservation System

http://slidepdf.com/reader/full/airway-reservation-system 2/8

<th scope="row">Departure Date :</th><td><?php include "calenderscript.php"; ?><input id="popup_container" type="text" name="date" /></td>

</tr><tr>

<th scope="row">Number of Persons :</th><td><select name="no_persons" id="no_persons">

<option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option>

</select></td></tr><tr>

<th scope="row">Select Class :</th><td><p><label>

<input name="class" type="radio" id="class_0" value="eco" checked="checked" />Economy</label>

<br /><label>

<input type="radio" name="class" value="buss" id="class_1" />Business</label>

(10% Extra Tariff)<br />

</p></td></tr><tr>

<th colspan="2" scope="row"><input type="submit" name="serch" id="serch"value="Search Flights" /></th>

</tr></table><p><?phpif(isset($_POST['date'])&&$_POST['src_list']!='select'&&$_POST['dest_list']!='select')

{ $srccode=$_POST['src_list'];$destcode=$_POST['dest_list'];$date=$_POST['date'];$number=$_POST['no_persons'];$class=$_POST['class'];

if($srccode==$destcode)echo "Source and Destination Station Cannot be Same";

else{

$connection = mysql_connect("localhost","root","");if (!$connection) {

die("Database connection failed: " . mysql_error());

Page 3: Airway Reservation System

7/28/2019 Airway Reservation System

http://slidepdf.com/reader/full/airway-reservation-system 3/8

}

// Select a database to use$db_select = mysql_select_db("airline",$connection);if (!$db_select) {

die("Database selection failed: " . mysql_error());}

echo "Source Stn : ".$srccode." Destination Stn : ".$destcode." Date of Journey : ".$date." ";

$res= mysql_query ("SELECT * FROM `flightlist` WHEREsrc_stn='".$srccode."' AND dest_stn='".$destcode."' ");

$num=mysql_numrows($res);

echo " Number of Flights Available : ";echo $num;

echo"<table width='833' border='1' align='center'><tr>

<th width='206'><div align='center'>S.NO </div></th><th width='306'><div align='center'>Flight Name </div></th><th width='206'><div align='center'>Source Station </div></th><th width='206'><div align='center'>Destination Station </div></th><th width='206'><div align='center'>Departure Time </div></th><th width='206'><div align='center'>Arrival Time</div></th><th width='206'><div align='center'>Duration </div></th><th width='206'><div align='center'>Price/Head </div></th><th width='206'><div align='center'>Book </div></th>

</tr><font face='Arial, Helvetica, sans-serif' color='#FF0000' size='16'>";

$loopcount=1;while($row = mysql_fetch_array($res)){

echo "<tr><td>";echo "<font color=red size=4> ".$loopcount." </font> ";echo "</td><td>";echo "<font color=red size=4> ".$row['flight_name']." </font> ";echo "</td><td>";

echo "<font color=red size=4> ".$row['src_stn']." </font> ";echo "</td><td>";

echo "<font color=red size=4> ".$row['dest_stn']." </font> ";echo "</td><td>";echo "<font color=red size=4> ".$row['departure']." </font> ";

echo "</td><td>";echo "<font color=red size=4> ".$row['Arrival']." </font> ";

echo "</td><td>";echo "<font color=red size=4> ".$row['duration']." </font> ";

Page 4: Airway Reservation System

7/28/2019 Airway Reservation System

http://slidepdf.com/reader/full/airway-reservation-system 4/8

echo "</td><td>";echo "<font color=red size=4> ".$row['price']." </font> ";

echo "</td><td>";echo "<font color=red size=4> <a

href='book.php?flightname=".$row['flight_name']."&noofpersons=".$number."&cost=".$

row['price']." '>Book IT</a> </font> ";echo "</td>";

echo "</tr>";

$loopcount++;}

'</table></font>';}

}?>

</form><p>&nbsp;</p></body></html>

Book.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">

<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Book Your Ticket</title></head>

<body><p>

<p style="text-align:center; color:red; font-size:18px">Airline Reservarion System</p>

</p><form action="book.php" method="post" name="book">

<p><?php

session_start();if(!isset($_POST['names'])){$_SESSION['flightname']= $_GET['flightname'];$_SESSION['noofpersons'] = $_GET['noofpersons'];$_SESSION['cost']= $_GET['cost'];}?>

Page 5: Airway Reservation System

7/28/2019 Airway Reservation System

http://slidepdf.com/reader/full/airway-reservation-system 5/8

</p><table width="492" border="0"><tr>

<th width="189" scope="row"><p>Enter the Names :</p><p>(Seperated by Comma)</p></th>

<td width="287"><label for="names"></label><textarea name="names" id="names" cols="45" rows="5"></textarea></td>

</tr><tr>

<th scope="row">Enter Your Ph No :</th><td><label for="phone"></label><input name="phone" type="text" id="phone" maxlength="10" /></td>

</tr><tr>

<th scope="row">Enter Your Mail id :</th><td><label for="email"></label>

<input type="email" name="email" id="email" /></td></tr><tr>

<th scope="row">Need Insurance for the Journey?</th><td><p><label>

<input name="insurance" type="radio" id="insurance_0" value="yes"checked="checked" />

YES</label>(RS. 150 Extra)<br /><label>

<input type="radio" name="insurance" value="no" id="insurance_1" /> NO</label>

<br /></p></td>

</tr><tr>

<th scope="row">Payment Method</th><td><p><label>

<input name="Payment" type="radio" id="PaymentMethod_0" value="credit"

checked="checked" />Credit Card</label><br /><label>

<input type="radio" name="Payment" value="debit" id="PaymentMethod_1" />Debit Card</label>

<br /><label>

<input type="radio" name="Payment" value="cash" id="PaymentMethod_2" />Cash</label>

<br />

</p></td></tr><tr>

Page 6: Airway Reservation System

7/28/2019 Airway Reservation System

http://slidepdf.com/reader/full/airway-reservation-system 6/8

<th colspan="2" scope="row"><input type="submit" name="pay" id="pay"value="BOOK FLIGHT" /></th>

</tr></table><p>&nbsp;</p>

</form><p><?php

if(isset($_POST['names'])){

$flightname= $_SESSION['flightname'];$nopersons = $_SESSION['noofpersons'];$cost= $_SESSION['cost'];$names= $_POST['names'];$phone=$_POST['phone'];$mail= $_POST['email'];

$insurance=$_POST['insurance'];$payment=$_POST['Payment'];

$connection = mysql_connect("localhost","root","");if (!$connection) {

die("Database connection failed: " . mysql_error());}

// Select a database to use$db_select = mysql_select_db("airline",$connection);if (!$db_select) {

die("Database selection failed: " . mysql_error());}if($insurance=="yes")

$cost+=150;

echo "<p><font color='red' size='18px'>Total Cost =".$cost." </font></p>";

$sql="INSERT INTO `passenger` VALUES('', '$names', '$phone','$mail','$flightname', '$insurance','$payment','$cost','$nopersons')";

$result=mysql_query($sql);

if($result)echo "Ticket Booked Successfully";else

echo "Booking Failed";

}?></p></body></html>

Page 7: Airway Reservation System

7/28/2019 Airway Reservation System

http://slidepdf.com/reader/full/airway-reservation-system 7/8

Database Structure:

1.  flightlist

2.   passenger 

OUTPUT:

Page 8: Airway Reservation System

7/28/2019 Airway Reservation System

http://slidepdf.com/reader/full/airway-reservation-system 8/8