-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfndb.php
More file actions
63 lines (57 loc) · 1.69 KB
/
fndb.php
File metadata and controls
63 lines (57 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 code for storing -->
<?php
$dt=$_POST['date'];
$slot=$_POST['slot'];
if(empty($_POST['txt1']) || empty($_POST['txt2']) || empty($_POST['txt3']) || empty($slot) || empty($dt))
{
?>
<script>
alert("Please enter all the details before booking..... ");
window.location="fn.php";
</script>
<?php
}
else
{
$courtname='footballnation';
$name=$_POST['txt1'];
$email=$_POST['txt2'];
$phno=$_POST['txt3'];
$slot=$_POST['slot'];
$dt=$_POST['date'];
$mysqli=new mysqli("localhost","root","","courtside");
$sql="select * from football where courtname='$courtname' AND slot='$slot' AND bkdate='$dt'";
$res=$mysqli->query($sql);
if ($res->num_rows>0) {
?>
<script>
alert("This slot is already booked try another slot..");
window.location="fn.php";
</script>
<?php
}
else
{
$sql1="INSERT INTO football (courtname,custname,phoneno,email,slot,bkdate) VALUES ('$courtname','$name','$phno','$email','$slot','$dt')";
$data = $mysqli->query($sql1);
if($data)
{
?>
<script>
alert("YOUR BOOKING IS COMPLETED...");
window.location="football.php";
</script>
<?php
}
else
{
?>
<script>
alert("YOUR BOOKING COULD NOT BE COMPLETED...");
window.location="fn.php";
</script>
<?php
}
}
}
?>