-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
96 lines (89 loc) · 2.71 KB
/
index.php
File metadata and controls
96 lines (89 loc) · 2.71 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
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
<?php
session_start();
include_once 'dbconnect.php';
if($_SERVER['REQUEST_METHOD']=='POST' && isset($_POST['setjourney'])){
if((strtotime($_POST['date'])<strtotime(date('Y-m-d')))){
echo "<script type='text/javascript'>alert('Please Enter correct Date');</script>";
}
if($_POST['from']!='' && $_POST['to']!='' && $_POST['date']!='' ) {
if (strpos($_POST['from'], ')') != true || strpos($_POST['from'], ')') != true){
echo "<script type='text/javascript'>alert('Enter correct stations name');</script>";
}else{
$_SESSION['from']=$_POST['from'];
$_SESSION['to']=$_POST['to'];
$_SESSION['date']=$_POST['date'];
header('Location:result.php');
}
}else{
echo "<script type='text/javascript'>alert('data can not be empty');</script>";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Home Page</title>
<link rel="stylesheet" type="text/css" href="css/index.css" ></link>
<body style=" background-color: #f7f7f7;">
<div>
<ul>
<?php if(isset($_SESSION['user_name'])){ ?>
<li><a class="active" href="#home">Home</a></li>
<li><a href="pnr_status.php">PNR Status</a></li>
<li><a href="cancel_ticket.php">Cancel Ticket</a></li>
<li style="float: right;"><a href="logout.php">Log Out</a></li>
<li style="float: right;"><p>Hi <?php echo " ".$_SESSION['user_name']." "?></p></li>
<?php } else {?>
<li><a class="active" href="#home">Home</a></li>
<li><a href="pnr_status.php">PNR Status</a></li>
<li style="float: right"><a href="signup.php">SignUp</a></li>
<li style="float: right"><a href="login.php">Login</a></li>
<?php }?>
</ul>
</div>
<div align="center" style="margin-top: 60px">
<h1 align="center">National Railway Reservation System</h1>
</div>
<div align="center" >
<h1 style="color:Blue">Set Your Journey</h1>
</div>
<div>
<<<<<<< HEAD
<form action="index.php" method="post">
=======
<form action="result.php" method="post">
>>>>>>> origin/master
<table align="center" style="margin-top: 30px" width="300" height="150">
<tr>
<td>From: </td>
<td><input list="stations" name="from" placeholder="From"></td>
</tr>
<tr>
<td>To: </td>
<td><input list="stations" name="to" placeholder="To"></td>
</tr>
<tr>
<td>Date of Journey: </td>
<td><input type="date" name="date" placeholder="dd-mm-yyyy"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="setjourney"></td>
</tr>
</table>
<?php
echo "<datalist id='stations'> ";
$sql="select stn_code,stn_name from stations";
$stmt = $conn->prepare($sql);
$stmt->execute();
$stmt->bind_result($stn_code,$stn_name);
while($stmt->fetch()){
echo '<option value="'.$stn_name.' ('.$stn_code.')">';
}
$stmt->close();
echo "</datalist>";
?>
</form>
</div>
</body>
</html>