-
Notifications
You must be signed in to change notification settings - Fork 1
/
dash.php
40 lines (32 loc) · 1019 Bytes
/
dash.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
<?php
include "config.php";
session_start();
$s=$_SESSION["p1"];
$d=$_SESSION["p2"];
$sit=$_SESSION["cls"]." ".$_SESSION["sit"];
$tname=$_POST["tname"];
$date=$_POST["date"];
$cost=$_POST["cost"];
$user=$_SESSION["user"];
$sql = "Select bankname,acn from user_info where username='$user'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$bank=$row["bankname"];
$acn=$row["acn"];
}
}
$sql = "Select time from train where name='$tname'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$time=$date."-".$row["time"];
}
}
$sql ="INSERT INTO `dashboard`(`username`, `train`, `sourse`, `destination`, `date`, `sit`, `cost`, `bank`, `ac`)
VALUES ('$user','$tname','$s','$d','$time','$sit','$cost','$bank','$acn')";
$result = $conn->query($sql);
header('location: dashboard.php');
?>