forked from Kashyap110/Railway-consession
-
Notifications
You must be signed in to change notification settings - Fork 0
/
passdetails.php
157 lines (148 loc) · 5.96 KB
/
passdetails.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<?php
error_reporting(0);
$conn = mysqli_connect("localhost","root","","studentconcession");
if(!$conn){
echo "<script type='text/javascript'>alert('Database failed');</script>";
die('Could not connect: '.mysqli_connect_error());
}
session_start();
$regid = $_SESSION['regid'];
if (isset($_POST['submit']))
{
$tkno=$_POST['tkno'];
$prevclass=$_POST['class1'];
$prevstartstation = $_POST['startstation1'];
$prevendstation=$_POST['endstation1'];
$stdate=$_POST['stdate'];
$enddate=$_POST['enddate'];
$currstartstation = $_POST['startstation2'];
$currendstation=$_POST['endstation2'];
$period=$_POST['period'];
$currclass=$_POST['class2'];
$sql = "INSERT INTO `passdetails`(`p_tk`, `p_class`, `prev_startstation`, `prev_endstation`, `p_startdate`, `end_date`, `curr_startstation`, `curr_endstation`, `p_period`, `curr_class`, `p_regid`) VALUES ('$tkno','$prevclass','$prevstartstation','$prevendstation','$stdate','$enddate','$currstartstation','$currendstation','$period','$currclass','$regid')";
if(mysqli_query($conn, $sql))
{
$message = "Pass details have been saved successfully";
header("Location:dashboard.html");
}
else
{
$message = "Could not insert record";
}
echo "<script type='text/javascript'>alert('$message');</script>";
}
//echo "<script> location.href='dashboard.html'; </script>";
//exit;
?>
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="UTF-8">
<title>Registration Form</title>
<link rel="stylesheet" href="css/details.css">
<script type="text/javascript" lang="javascript" src="js/details.js"></script>
</head>
<body>
<h1>Pass Details</h1>
<h3 style="color: white">Previous Pass Details</h3>
<form action="" method="post">
<div class="row">
<div class="col-10">
<label for="tkno">Ticket Number</label>
</div>
<div class="col-90">
<input type="text" id="tkno" name="tkno" id="tkno" placeholder="Enter previous ticket number">
</div>
</div>
<div class="row">
<div class="col-10">
<label for="class1">Class</label>
</div>
<div class="col-90">
<select id="class1" name="class1" required>
<option disabled selected>Select class *</option>
<option>First</option>
<option>Second</option>
</select>
</div>
</div>
<div class="row">
<div class="col-10">
<label for="startstation1">Starting Station</label>
</div>
<div class="col-90">
<input type="text" id="startstation1" name="startstation1" placeholder="Enter starting station">
</div>
</div>
<div class="row">
<div class="col-10">
<label for="endstation1">Ending Station</label>
</div>
<div class="col-90">
<input type="text" id="endstation1" name="endstation1" placeholder="Enter ending station">
</div>
</div>
<div class="row">
<div class="col-10">
<label for="stdate">Start Date</label>
</div>
<div class="col-90">
<input type="date" id="stdate" name="stdate" maxlength="10" placeholder="Enter start date">
</div>
</div>
<div class="row">
<div class="col-10">
<label for="enddate">End Date</label>
</div>
<div class="col-90">
<input type="date" id="enddate" name="enddate" maxlength="10" placeholder="Enter End date">
</div>
</div>
<h3 style="color: white">New Pass Details</h3>
<div class="row">
<div class="col-10">
<label for="startstation2">Start Station</label>
</div>
<div class="col-90">
<input type="text" id="startstation2" name="startstation2" placeholder="Enter Start Station">
</div>
</div>
<div class="row">
<div class="col-10">
<label for="endstation2">End Station</label>
</div>
<div class="col-90">
<input type="text" id="endstation2" name="endstation2" placeholder="Enter End Station">
</div>
</div>
<div class="row">
<div class="col-10">
<label for="period">Period</label>
</div>
<div class="col-90">
<select id="period" name="period" required>
<option disabled selected>Select duration *</option>
<option>Monthly</option>
<option>Quarterly</option>
</select>
</div>
</div>
<div class="row">
<div class="col-10">
<label for="class2">Class</label>
</div>
<div class="col-90">
<select id="class2" name="class2" required>
<option disabled selected>Select class *</option>
<option>First</option>
<option>Second</option>
</select>
</div>
</div>
</div><br>
<div class="row">
<input type="submit" value="Register" id="submit" name="submit">
</div>
</form>
</body>
</html>