-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinsertPatient.php
More file actions
102 lines (95 loc) · 3.79 KB
/
Copy pathinsertPatient.php
File metadata and controls
102 lines (95 loc) · 3.79 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
97
98
99
100
101
102
<!-- Made By Bharat -->
<?php
/*create a connection with the database*/
$con = mysqli_connect("localhost","root","") or die ("Error Occures");
mysqli_select_db($con, "hospital_management_system") or die ("Error Occures");
error_reporting(0);
$pid = $_POST["pid"];
$pname = $_POST["pname"];
$num = $_POST["tp"];
$dob = $_POST["dob"];
$gen = $_POST["gender"];
$wid = $_POST["wid"];
$eid = $_POST["eid"];
$date = $_POST["date"];
if($_POST["submit"]) {
$sql_1 = "INSERT INTO patient VALUES ('$pid','$pname','$num','$dob','$gen','$wid','$eid')";
$sql_2 = "INSERT INTO admit VALUES ('$pid','$eid','$wid','$date')";
$sql_3 = "INSERT INTO plog VALUES ('$pid','$pid')";
if(mysqli_query($con, $sql_1)) {
if(mysqli_query($con, $sql_2)) {
if(mysqli_query($con, $sql_3)) {
echo "Data Inserted Successfully";
}
}
else {
echo "Something wrong with admitting section";
}
}
else {
echo "Oops ! Something went wrong.Try again";
}
}
else {
echo "Insert the data";
}
?>
<html>
<head>
<title>Insert New Patient to the Database</title>
<link rel="stylesheet" type="text/css" href="css/demo.css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link rel="stylesheet" type="text/css" href="css/animate-custom.css" />
</head>
<body>
<div class="container">
<header><h1>Insert Patient</h1></header>
<section>
<div id="container_demo" >
<div id="wrapper">
<div id="login" class="animate form">
<form action="insertPatient.php" method="POST">
<h1>Insert Patient Details</h1>
<p>
<label data-icon="u">Patient ID :</label>
<input id="pid" name="pid" required="required" type="text" placeholder="Insert patient ID" />
</p>
<p>
<label data-icon="u">Patient Name :</label>
<input name="pname" required="required" type="text" placeholder="Insert patient name" />
</p>
<p>
<label data-icon="u">Phone Number :</label>
<input name="tp" required="required" type="number" placeholder="Insert patient phone number" />
</p>
<p>
<label data-icon="u">Date of Birth :</label>
<input name="dob" required="required" type="text" placeholder="Insert patient birth day" />
</p>
<p>
<label data-icon="u">Gender :</label>
<input name="gender" required="required" type="text" placeholder="Insert patient gender < M or F >" />
</p>
<p>
<label data-icon="u">Ward ID :</label>
<input name="wid" required="required" type="text" placeholder="Insert patient ward ID" />
</p>
<p>
<label data-icon="u">Admitting Date :</label>
<input name="date" required="required" type="text" placeholder="Insert admitting date" />
</p>
<p>
<label data-icon="u">Consultant/Doctor ID :</label>
<input name="eid" required="required" type="text" placeholder="Insert doctor/consultant ID" />
</p>
<p class="signin button">
<input type="submit" name="submit" value="Submit"/>
</p>
</form>
</div>
</div>
</div>
</section>
</div>
</body>
</html>