Commit a44f63b3 by Ryo

Updated booking_page.php

parent 6aa7506d
Showing with 2 additions and 187 deletions
...@@ -5,109 +5,9 @@ ...@@ -5,109 +5,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="css2.css"> <link rel="stylesheet" type="text/css" href="css2.css">
<link rel="stylesheet" type="text/css" href="css/booking_page_style.css">
<script defer src="mainjs.js"></script> <script defer src="mainjs.js"></script>
<style>
.container {
max-width: 600px;
margin: 0 auto;
position: relative;
}
#search input[type="departure"],
#search input[type="arrival"],
#search input[type="class"],
#search input[type="date"],
#search input[type="date"],
#search input[type="filters"],
#search button[type="submit"] {
font: 400 12px/16px "Roboto", Helvetica, Arial, sans-serif;
}
#search {
background: #F9F9F9;
padding: 25px;
margin: 15px 0;
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 5px 5px 0 rgba(0, 0, 0, 0.24);
}
#search h3 {
display: block;
font-size: 30px;
font-weight: 300;
margin-bottom: 10px;
}
#search h4 {
margin: 5px 0 15px;
display: block;
font-size: 13px;
font-weight: 400;
}
fieldset {
border: medium none !important;
margin: 0 0 10px;
min-width: 100%;
padding: 0;
width: 100%;
}
#search input[type="departure"],
#search input[type="arrival"],
#search input[type="class"],
#search input[type="date"],
#search input[type="date"],
#search input[type="filters"] {
width: 100%;
border: 1px solid #ccc;
background: #FFF;
margin: 0 0 5px;
padding: 10px;
}
#search input[type="departure"]:hover,
#search input[type="arrival"]:hover,
#search input[type="class"],
#search input[type="date"]:hover,
#search input[type="date"]:hover,
#search input[type="filters"]:hover {
-webkit-transition: border-color 0.3s ease-in-out;
-moz-transition: border-color 0.3s ease-in-out;
transition: border-color 0.3s ease-in-out;
border: 1px solid #aaa;
}
#search button[type="submit"] {
cursor: pointer;
width: 100%;
border: none;
background: #4CAF50;
color: #FFF;
margin: 0 0 5px;
padding: 10px;
font-size: 20px;
}
#search button[type="submit"]:hover {
background: #43A047;
-webkit-transition: background 0.3s ease-in-out;
-moz-transition: background 0.3s ease-in-out;
transition: background-color 0.3s ease-in-out;
}
#search button[type="submit"]:active {
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}
#search input:focus,
#search textarea:focus {
outline: 0;
border: 1px solid #aaa;
}
</style>
</head> </head>
<body> <body>
...@@ -174,95 +74,10 @@ ...@@ -174,95 +74,10 @@
</form> </form>
<?php <?php
//This is only displayed if the user submitted the form include('php_files/booking_page_database.php');
if (isset($_POST['flight_search'])){
echo "<h2>Results</h2><p>";
//If the user did not enter a search term, they receive an error
if ($_POST['departure'] and $_POST['arrival']== ""){
echo "<p>Please enter a search term";
exit;
}
// Otherwise we connect to the database
$con = mysqli_connect("anysql.itcollege.ee", "WT16", "iLtQlUerkT", "WT16");
// Check connection
if (mysqli_connect_errno()){
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$departure = ($_POST["departure"]);
$arrival = ($_POST["arrival"]);
$date_going = ($_POST["trip_going"]);
$date_back = ($_POST["trip_back"]);
}
//echo "$departure";
//echo "$arrival";
//Now we search for our search term, in the field the user specified
//if Morning_AfterNoon_Night = Morning
//$data = mysqli_query($con, "SELECT * FROM FlightData WHERE departure = '$departure' AND arrival = '$arrival'");
$int = 0;
foreach ($_POST['check_list'] as $select){
if ($int > 0){
$filter = $filter . " or Morning_AfterNoon_Night ='" . $select . "'" ;
}
else {
$filter = " and Morning_AfterNoon_Night ='" . $select . "'" ;
}
$int = $int + 1;
}
//$a = $a . ")";
if(isset($_POST['radio'])){
echo "You have selected :".$_POST['radio'];
}
if ($_POST['radio'] === 'htolcost'){
$order = " ORDER BY Price DESC" ;
}
else {
$order = " ORDER BY Price" ;
}
//echo "SELECT * FROM FlightData WHERE departure = '$departure' AND arrival = '$arrival' " . "$a";
//$data = mysqli_query($con, "SELECT * FROM FlightData WHERE departure = '$departure' AND arrival = '$arrival'");
$data = mysqli_query($con, "SELECT * FROM FlightData WHERE departure = '$departure' AND arrival = '$arrival' " . "$filter" . "$order");
//And display the results
while($row = mysqli_fetch_array( $data )){
echo "$row[1]". " " ."$row[2]". " " . "$row[3]". " " . "$row[4]". " " . "$row[5]". " " . "$row[6]". " " . "$row[7]". " " . "$row[8]". " " . "$row[9]" . " " . "$date_going". " " . "$date_back". " " ."<a href='loginform2.php?Flight_Id=$row[0]' >". "SELECT" ."</a>";
echo "<br>";
}
//This counts the number or results. If there aren't any, it gives the user a "no match" message
$anymatches=mysqli_num_rows($data);
if ($anymatches == 0){
echo "Sorry, but we can not find an entry to match your query<br><br>";
}
//And reminds the user what they searched for
echo "<b>Searched For:</b> " . "$find";
}
//break;
if (isset($_GET['Flight_Id#'])) {
$Flight_Id = $_GET['Flight_Id'];
echo $Flight_Id;
}
?> ?>
</fieldset> </fieldset>
</div> </div>
</div> </div>
</body> </body>
</html> </html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment