-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathticket.php
More file actions
63 lines (60 loc) · 1.69 KB
/
Copy pathticket.php
File metadata and controls
63 lines (60 loc) · 1.69 KB
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
<?php
include "db.php";
// define variables and set to empty values
$platformno = $name = $quantity = "";
if (isset($_POST['submit'])) {
$platformno = test_input($_POST["platformno"]);
$name = test_input($_POST["name"]);
$quantity = test_input($_POST["quantity"]);
$query = "SELECT * FROM cost WHERE quantity ='$quantity'";
$result12= mysqli_query($conn, $query);
if(mysqli_num_rows($result12) == 1)
{
$res=mysqli_query($conn,"INSERT into buy value('$platformno','$name','$quantity')");
echo mysqli_error($conn);
if($res)
{
$query = "SELECT * FROM cost WHERE quantity ='$quantity'";
$result1 = mysqli_query($conn, $query);
if(mysqli_num_rows($result1) == 1)
{
while($row = mysqli_fetch_array($result1))
{
?><h1><?php echo "you have to pay";?></h1>
<h1><?php echo $row["price"];?></h1><?php
}
}
}
else
{
echo "sorry you cannot buy more than 4 tickets";
}
}
else{
echo "<script type='text/javascript'>alert('sorry you cannot buy more than four tickets');</script>";
include "buy.php";
}
}
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>
<html>
<head>
</head>
<body bgcolor="blue">
<style>
body{
background-image: url("./bg.jpg");
height: 100%;
/* Center and scale the image nicely */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
</style>
</body>
</html>