-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrain.php
More file actions
28 lines (28 loc) · 850 Bytes
/
Copy pathtrain.php
File metadata and controls
28 lines (28 loc) · 850 Bytes
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
<?php
include "db.php";
// define variables and set to empty values
$trainno= $trainname = $source = $destination = $arrivaltime = $departuretime= "";
if (isset($_POST['submit'])) {
$trainno = test_input($_POST["trainno"]);
$trainname = test_input($_POST["trainname"]);
$source = test_input($_POST["source"]);
$destination = test_input($_POST["destination"]);
$arrivaltime = test_input($_POST["arrivaltime"]);
$departuretime = test_input($_POST["departuretime"]);
$res=mysqli_query($conn,"INSERT into trainform values('$trainno','$trainname','$source','$destination','$arrivaltime','$departuretime')");
if($res)
{
include "displaytrain.php";
}
}
else
{
echo "";
}
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>