-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser_detail.php
49 lines (33 loc) · 1.05 KB
/
user_detail.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
<!DOCTYPE html>
<html>
<body>
<?php
// escape variables for security
$username = $_POST['username'];
$hospital= $_POST['hospital'];
$company = $_POST['company'];
$bags = $_POST['bags'];
// include db connect class
require_once __DIR__ . '/db_connect.php';
// connecting to db
$db = new DB_CONNECT();
$result=mysql_query("INSERT INTO USERDETAIL (USERNAME , HOSPITAL, COMPANY, BAGS)
VALUES ('$username', '$hospital','$company', '$bags')");
// check if row inserted or not
if ($result) {
// successfully inserted into database
header('location: http://localhost/iCare/timeLinePage.htm');
// echoing JSON response
echo json_encode($response);
} else {
// failed to insert row
// success
header('location: http://localhost/iCare/user_detail.html');
$response["success"] = 0;
$response["message"] = "Oops! An error occurred.";
// echoing JSON response
echo json_encode($response);
}
?>
</body>
</html>