-
Notifications
You must be signed in to change notification settings - Fork 1
/
ticketConfirm.php
65 lines (52 loc) · 1.97 KB
/
ticketConfirm.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
require "conn.php";
$airline = $_POST["airline"];
$flightNo = $_POST["flightNo"];
$source = $_POST["source"];
$destination = $_POST["destination"];
$arrivalTime = $_POST["arrivalTime"];
$deptTime = $_POST["deptTime"];
$name = $_POST["name"];
$phone = $_POST["phone"];
$date = $_POST["date"];
$mail = $_POST["mail"];
$adhaar = $_POST["adhaar"];
$passport = $_POST["passport"];
$Class = $_POST["Class"];
$seats = $_POST["seats"];
$ticketNumber = $_POST["ticketNumber"];
$price = $_POST["price"];
//$mysql_qry0 = mysql_query("select totalSeats
// from seatMatrix
// WHERE totalSeats > $seats and flight_no = $flightNo;");
$mysql_qry = "insert into booked_ticket (airline, flight_no, sour, dest, arr_time, dept_time, pass_name, phone_no, travel_date, mail, adhaar_no,passport_no, travel_class, no_of_seats, ticket_no, ticketPrice)
values('$airline', '$flightNo', '$source', '$destination', '$arrivalTime', '$deptTime', '$name', '$phone', '$date', '$mail', '$adhaar', '$passport', '$Class', '$seats', '$ticketNumber', '$price');";
$mysql_qry2 = "UPDATE seatMatrix
SET
totalSeats = totalSeats - $seats
WHERE
flight_no = $flightNo;";
$to = "[email protected]";
$subject = "Test mail";
$message . = '<html><body>';
$message . = '<table rules="all" style="border-color: #666;" cellpadding="10">';
$message . ="<tr style='background: #eee;'><td><strong>Attribute</strong> </td><td>Value</td></tr>";
$message . = "<tr><td><strong>Airline</strong> </td><td>"$airline"</td></tr>";
$message . =
$message . =
$message . =
$message . =
$message . =
Airline :$airline";
$from = "[email protected]";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
if($conn->query($mysql_qry) === TRUE and $conn->query($mysql_qry2) === TRUE){
echo "Ticket Booked!!!";
}
else {
echo "Error: " . $mysql_qry . "<br>" .$conn->error;
}
$conn->close();
?>