-
Notifications
You must be signed in to change notification settings - Fork 50
/
insert_into_classseats_4.php
58 lines (48 loc) · 2.36 KB
/
insert_into_classseats_4.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
<html>
<body style=" background-image: url(adminlogin.jpeg);
height: 100%;
background-position: center;
background-repeat: no-repeat;
background-size: cover;">
<?php
session_start();
require "db.php";
$stations=$_SESSION["stations"];
$temp=0;
while ($temp<$_SESSION["ns"])
{
if($_POST["s1".$temp]>0)
{$sql = "INSERT INTO classseats (trainno,sp,dp,doj,class,seatsleft,fare) VALUES ('".$_SESSION["trainno"]."','".$_SESSION["st".$temp]."','".$_SESSION["st".($temp+1)]."','".$_SESSION["doj"]."','AC1','".$_POST["s1".$temp]."','".$_POST["f1".$temp]."')";
$flag=($conn->query($sql));
}
if($_POST["s2".$temp]>0)
{$sql = "INSERT INTO classseats (trainno,sp,dp,doj,class,seatsleft,fare) VALUES ('".$_SESSION["trainno"]."','".$_SESSION["st".$temp]."','".$_SESSION["st".($temp+1)]."','".$_SESSION["doj"]."','AC2','".$_POST["s2".$temp]."','".$_POST["f2".$temp]."')";
$flag=($conn->query($sql));
}
if($_POST["s3".$temp]>0)
{$sql = "INSERT INTO classseats (trainno,sp,dp,doj,class,seatsleft,fare) VALUES ('".$_SESSION["trainno"]."','".$_SESSION["st".$temp]."','".$_SESSION["st".($temp+1)]."','".$_SESSION["doj"]."','AC3','".$_POST["s3".$temp]."','".$_POST["f3".$temp]."')";
$flag=($conn->query($sql));
}
if($_POST["s4".$temp]>0)
{$sql = "INSERT INTO classseats (trainno,sp,dp,doj,class,seatsleft,fare) VALUES ('".$_SESSION["trainno"]."','".$_SESSION["st".$temp]."','".$_SESSION["st".($temp+1)]."','".$_SESSION["doj"]."','CC','".$_POST["s4".$temp]."','".$_POST["f4".$temp]."')";
$flag=($conn->query($sql));
}
if($_POST["s5".$temp]>0)
{$sql = "INSERT INTO classseats (trainno,sp,dp,doj,class,seatsleft,fare) VALUES ('".$_SESSION["trainno"]."','".$_SESSION["st".$temp]."','".$_SESSION["st".($temp+1)]."','".$_SESSION["doj"]."','EC','".$_POST["s5".$temp]."','".$_POST["f5".$temp]."')";
$flag=($conn->query($sql));
}
if($_POST["s6".$temp]>0)
{$sql = "INSERT INTO classseats (trainno,sp,dp,doj,class,seatsleft,fare) VALUES ('".$_SESSION["trainno"]."','".$_SESSION["st".$temp]."','".$_SESSION["st".($temp+1)]."','".$_SESSION["doj"]."','SL','".$_POST["s6".$temp]."','".$_POST["f6".$temp]."')";
$flag=($conn->query($sql));
}
$temp+=1;
}
if ($flag === TRUE) {
echo "New seat arrangement added successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
echo "<br> <a href=\"http://localhost/railway/admin_login.php\">Go Back to Admin Menu!!!</a> ";
?>
</body>
</html>