<?php include('session.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>Payment</title> <link rel="stylesheet" type="text/css" href="css2.css"> <style> /* * { box-sizing: border-box; } .header { border: 1px solid green; padding: 15px; } .row::after { content: ""; clear: both; display: table; } ul { list-style-type: none; margin: 0; padding: 0; overflow: hidden; background-color: #333; } li { float: left; } li a { display: block; color: white; text-align: center; padding: 14px 16px; text-decoration: none; } li a:hover { background-color: #111; } [class*="col-"] { float: left; padding: 15px; border: 3px solid blue; } /* This is allocating layout spaces for how the website is going to be allocated the spaces for different contencts. */ /* .col-1 {width: 8.33%;} .col-2 {width: 16.66%;} .col-3 {width: 25%;} .col-4 {width: 33.33%;} .col-5 {width: 41.66%;} .col-6 {width: 50%;} .col-7 {width: 58.33%;} .col-8 {width: 66.66%;} .col-9 {width: 75%;} .col-10 {width: 83.33%;} .col-11 {width: 91.66%;} .col-12 {width: 100%;} ul { list-style-type: none; margin: 0; padding: 0; overflow: hidden; background-color: #333; } li { float: left; } li a { display: block; color: white; text-align: center; padding: 14px 16px; text-decoration: none; } li a:hover:not(.active) { background-color: #111; } .active { background-color: #4CAF50; } @import url(https://fonts.googleapis.com/css?family=Roboto:400,300,600,400italic); * { margin: 0; padding: 0; box-sizing: border-box; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -webkit-font-smoothing: antialiased; -moz-font-smoothing: antialiased; -o-font-smoothing: antialiased; font-smoothing: antialiased; text-rendering: optimizeLegibility; } body { font-family: "Roboto", Helvetica, Arial, sans-serif; font-weight: 100; font-size: 15px; line-height: 30px; color: #777; background: #ffffff; } .container { max-width: 400px; width: 100%; margin: 0 auto; position: relative; } */ */ #contact input[type="first_name"], #contact input[type="last_name"], #contact input[type="card_type"], #contact input[type="card_number"], #contact input[type="security_code"], #contact input[type="date"], #contact input[type="passport"], #contact input[type="phone_number"], #contact input[type="email"], #contact textarea, #contact button[type="submit"] { font: 400 12px/16px "Roboto", Helvetica, Arial, sans-serif; } #contact { 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); } #contact h3 { display: block; font-size: 30px; font-weight: 300; margin-bottom: 10px; } #contact 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%; } #contact input[type="first_name"], #contact input[type="last_name"], #contact input[type="card_type"], #contact input[type="card_number"], #contact input[type="security_code"], #contact input[type="date"], #contact input[type="passport"], #contact input[type="phone_number"], #contact input[type="email"], #contact textarea { width: 100%; border: 1px solid #ccc; background: #FFF; margin: 0 0 5px; padding: 10px; } #contact input[type="first_name"]:hover, #contact input[type="last_name"]:hover, #contact input[type="card_type"]:hover, #contact input[type="card_number"]:hover, #contact input[type="security_code"]:hover, #contact input[type="date"]:hover, #contact input[type="passport"]:hover, #contact input[type="phone_number"]:hover, #contact input[type="eamil"]:hover, #contact textarea: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; } #contact textarea { height: 100px; max-width: 100%; resize: none; } #contact button[type="submit"] { cursor: pointer; width: 100%; border: none; background: #4CAF50; color: #FFF; margin: 0 0 5px; padding: 10px; font-size: 20px; } #contact 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; } #contact button[type="submit"]:active { box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5); } #contact input:focus, #contact textarea:focus { outline: 0; border: 1px solid #aaa; } ::-webkit-input-placeholder { color: #888; } :-moz-placeholder { color: #888; } ::-moz-placeholder { color: #888; } :-ms-input-placeholder { color: #888; } </style> </head> <body> <?php $First_Name = $Last_Name = $Email_Address = $Card_Type = $Card_Number = $Security_Code = $Expiration_Month_Year = $Passport_Number = $Phone_Number = $Home_Address = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { $First_Name = test_input($_POST["First_Name"]); $Last_Name = test_input($_POST["Last_Name"]); $Email_Address = test_input($_POST["Email_Address"]); $Card_Type = test_input($_POST["Card_Type"]); $Card_Number = test_input($_POST["Card_Number"]); $Security_Code = test_input($_POST["Security_Code"]); $Expiration_Month_Year = test_input($_POST["Expiration_Month_Year"]); $Passport_Number = test_input($_POST["Passport_Number"]); $Phone_Number = test_input($_POST["Phone_Number"]); $Home_Address = test_input($_POST["Home_Address"]); } function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } ?> <ul> <li><a href="index.php">Home</a></li> <li><a class="active" href="booking_page.php">Booking</a></li> <li><a href="contact.php">Contact</a></li> <li><a href="user_login.php">Login</a></li> <li><a href="loginform_for_admin_2.php">Admin login</a></li> <li style="float:right"><a href="logout.php">Logout</a></li> </ul> <div class="row"> <div class="container"> <fieldset> <form id="contact" method="post" action="<?php $PHP_SELF?>"> <legend><h1>Please fill in the form in order to complete your purchase</h1></legend> <?php session_start(); $Flight_Id = $_SESSION['Flight_Id']; echo $Flight_Id; //session_start(); $username_value = $_SESSION['username']; echo $username_value; //session_start(); $password_value = $_SESSION['password']; echo $password_value; $con2 = mysqli_connect(localhost, root, root, Airline_Booking, 8889); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $memberData = mysqli_query($con2, "SELECT * FROM User_register WHERE username = '$username_value' AND password = '$password_value' "); while($row = mysqli_fetch_array( $memberData )) { echo "$row[0]". " " ."$row[1]". " " . "$row[2]"; $ID = $row[0]; echo $ID; echo "<br>"; } mysqli_close($con2); ?> <legend>Please enter your first and last name:</legend> <br> <label for="first_name">First Name: </label> <input placeholder="First Name" type="first_name" name="First_Name" tabindex="1" required autofocus/> <br> <label for="last_name">Last Name: </label> <input placeholder="Last Name" type="last_name" name="Last_Name" tabindex="2" required/> <br> <label for="email Address">Email Address: </label> <input placeholder="Email Address" type="email" name="Email_Address" tabindex="2" required/> <br> <label for="card_type">Please enter your card type <b> e.g such as Visa Card, Master Card, American Express etc... </b></label> <input placeholder="Card Type" type="card_type" name="Card_Type" tabindex="2" required/> <br> <label for="card_number">Card Number: </label> <input placeholder="Card Number" type="card_number" name="Card_Number" tabindex="1" required autofocus/> <br> <label for="security_code">Security Code: </label> <input placeholder="Security Code" type="security_code" name="Security_Code" tabindex="1" required autofocus/> <br> <legend>Please enter your expiary month and date of your card. *<b>Please leave the date section as 01</b>*:</legend> <label for="date">Expiary month and year: </label> <input type="date" id="Expiration_Month_Year" name="Expiration_Month_Year" value="yyyy-mm-dd" min="2018-01-01" max="9000-12-21"/> <br> <label for="passport">Passport Number: </label> <input placeholder="Passport Number" type="passport" name="Passport_Number" tabindex="1" required autofocus/> <br> <label for="phone_number">Phone Number: </label> <input placeholder="Phone Number" type="phone_number" name="Phone_Number" tabindex="1" required autofocus/> <br> <label for="textarea">Home Address: </label> <textarea placeholder="Please type in your home address" name="Home_Address" tabindex="5" required></textarea> <br> <p>Please confirm your order. If you would like to cancel the order please click on the "Logout" button on the top right hand corner.</p> <?php // Otherwise we connect to the database $con1 = mysqli_connect(localhost, root, root, Airline_Booking, 8889); // Check connection if (mysqli_connect_errno()){ echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $flight_data = mysqli_query($con1, "SELECT * FROM FlightData WHERE Flight_Id = '$Flight_Id' "); //And display the results while($row = mysqli_fetch_array( $flight_data )) { echo "$row[1]". " | " ."$row[2]". " | " . "$row[3]". " | " . "$row[4]". " | " . "$row[5]". " | " . "$row[6]". " | " . "$row[7]". " | " . "$row[8]". " | " . "$row[9]" . " "; echo "<br>"; } $anymatches=mysqli_num_rows($flight_data); if ($anymatches == 0){ echo "Sorry, but we can not find an entry to match your query<br><br>"; } mysqli_close($con1); ?> <br> <input type="submit" name="submit" value="Submit" /> </form> <?php #echo "Insert new user"; // connect to the database // mysql_connect('localhost', 'root', 'root') or die(mysql_error()); // mysql_select_db("Airline_Booking") or die(mysql_error()); // // $data1 = mysql_query("INSERT INTO Passenger_Profile (First_Name, Last_Name, Email_Address, Card_Type, Card_Number, Security_Code, Expiration_Month_Year, // Passport_Number, Phone_Number, Home_Address) // VALUES ('$First_Name', '$Last_Name', '$Email_Address', '$Card_Type', '$Card_Number', '$Security_Code','$Expiration_Month_Year', '$Passport_Number', '$Phone_Number', '$Home_Address')"); // $data2 = mysql_query("INSERT INTO Payment_Details (First_Name, Last_Name, Card_Type, Card_Number, Security_Code, Expiration_Month_Year) // VALUES ('$First_Name', '$Last_Name', '$Card_Type', '$Card_Number', '$Security_Code','$Expiration_Month_Year')"); //mysql_query($sql1, $con); $con = mysqli_connect(localhost, root, root, Airline_Booking, 8889); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } // $Departure = strtoupper($_POST['Departure']); // $Arrival = strtoupper($_POST['Arrival']); // $data = mysqli_query($con, "INSERT INTO Passenger_Profile (First_Name, Last_Name, Email_Address, Card_Type, Card_Number, Security_Code, Expiration_Month_Year, Passport_Number, Phone_Number, Home_Address) VALUES ('$First_Name', '$Last_Name', '$Email_Address', '$Card_Type', '$Card_Number', '$Security_Code', '$Expiration_Month_Year', '$Passport_Number', '$Phone_Number', '$Home_Address')"); //Returning the id that was inserted // $last_id = mysqli_insert_id($con); // $data_2 = mysqli_query($con, "INSERT INTO Ticket_Info (Profile_Id, Flight_Id, First_Name, Last_Name) // VALUES ('$last_id', '$Flight_Id', '$First_Name', '$Last_Name', '$Email_Address')"); $data1 = mysqli_query($con, "INSERT INTO Passenger_Profile (First_Name, Last_Name, Email_Address, Card_Type, Card_Number, Security_Code, Expiration_Month_Year, Passport_Number, Phone_Number, Home_Address) VALUES ('$First_Name', '$Last_Name', '$Email_Address', '$Card_Type', '$Card_Number', '$Security_Code', '$Expiration_Month_Year', '$Passport_Number', '$Phone_Number', '$Home_Address')"); // $data3 = mysqli_query($con, "INSERT INTO Ticket_Info (Flight_Number, Date_Going, Date_Back) // VALUES ('$Flight_Number', '$Date_Going', '$Date_Back')"); //Returning the id that was inserted $last_id = mysqli_insert_id($con); $data2 = mysqli_query($con, "INSERT INTO Ticket_Info (Profile_Id, Flight_Id, First_Name, Last_Name) VALUES ('$last_id', '$Flight_Id', '$First_Name', '$Last_Name')"); echo $last_id; mysqli_close($con); echo "Your input:::::::::<br>"; echo "".$First_Name. "<br>"; echo "".$Last_Name. "<br>"; echo "".$Email_Address. "<br>"; echo "".$Card_Type. "<br>"; echo "".$Card_Number. "<br>"; echo "".$Security_Code. "<br>"; echo "::::".$Expiration_Month_Year. "<br>"; echo "".$Passport_Number. "<br>"; echo "".$Phone_Number. "<br>"; echo "".$Home_Address. "<br>"; echo "".$last_id. "<br>"; ?> </fieldset> </div> </div> </body> </html>