-
Notifications
You must be signed in to change notification settings - Fork 2
/
new.php
193 lines (161 loc) · 6.85 KB
/
new.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
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Health Check</title>
<!-- Bootstrap core CSS -->
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/scrolling-nav.css" rel="stylesheet">
</head>
<body id="page-top">
<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top" id="mainNav">
<div class="container">
<a class="navbar-brand js-scroll-trigger" href="#page-top">Health Check</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link js-scroll-trigger" href="index.html#new">New User</a>
</li>
<li class="nav-item">
<a class="nav-link js-scroll-trigger" href="index.html#update">Update Existing</a>
</li>
<li class="nav-item">
<a class="nav-link js-scroll-trigger" href="index.html#view">View Record</a>
</li>
</ul>
</div>
</div>
</nav>
<header class="bg-primary text-white">
<div class="container text-center">
<img src="icon.png" class="float-left" style="width:200px;height:200px;">
<h1>Welcome to Health Check</h1>
<p class="lead">Easiest way to provide doctors with up-to-date information about patients medical history.<br> concise data on the symptoms and prescribed medicines</p>
</div>
</header>
<section id="new">
<div class="container">
<div class="row">
<div class="col-lg-8 mx-auto">
<br>
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "health";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$nm = $_POST["name"];
$ag = $_POST["age"];
$gen = $_POST["gender"];
$id = $_POST["id"];
$sm = $_POST["symptom"];
$pr = $_POST["prescription"];
$idd = parse_str('$id');
$sql = "INSERT INTO main VALUES ('$nm', $ag, '$gen', '$id' );";
$sql .= "CREATE TABLE `health`.`$id` ( `time` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),`symptom` VARCHAR(100) NOT NULL , `prescription` VARCHAR(100) NOT NULL ) ENGINE = InnoDB;";
$sql .= "INSERT INTO `$id` (`symptom`, `prescription` ) VALUES ('$sm', '$pr' ); ";
if ($conn->multi_query($sql) === TRUE) {
echo "<h1>"."New patient record added successfully"."<h1>";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>
<br><br>
<a href="index.html#new" class="btn btn-info" role="button">Add Another</a>
<br><br>
</div>
</div>
</div>
</section>
<section id="update" class="bg-light">
<div class="container">
<div class="row">
<div class="col-lg-8 mx-auto">
<h2>Update Existing</h2>
<br>
<br>
<form class="form-horizontal" action="update.php#update" method="POST">
<fieldset>
<!-- Text input-->
<div class="form-group">
<label class="col-md-12 control-label" for="ID">ID</label>
<div class="col-md-12">
<input id="ID" name="id" placeholder="Aadhar ID" class="form-control input-md" required="" type="text">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-12 control-label" for="symptom">Symptom</label>
<div class="col-md-12">
<input id="symptom" name="symptom" placeholder="symptom" class="form-control input-md" required="" type="text">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-12 control-label" for="prescription">Prescription</label>
<div class="col-md-12">
<input id="prescription" name="prescription" placeholder="prescription" class="form-control input-md" required="" type="text">
</div>
</div>
<br><br>
<button type="submit" class="btn btn-primary">Submit</button>
</fieldset>
</form>
</div>
</div>
</div>
</section>
<section id="view">
<div class="container">
<div class="row">
<div class="col-lg-8 mx-auto">
<h2>View Record</h2>
<br><br>
<form class="form-horizontal" action="view.php" method="POST">
<fieldset>
<!-- Text input-->
<div class="form-group">
<label class="col-md-12 control-label" for="id">ID</label>
<div class="col-md-12">
<input id="id" name="id" placeholder="Aadhar ID" class="form-control input-md" required="" type="text">
</div>
</div>
<br><br>
<button type="submit" class="btn btn-primary">Submit</button>
</fieldset>
</form>
<br><br><br><br>
</div>
</div>
</div>
</section>
<!-- Footer -->
<footer class="py-5 bg-dark">
<div class="container">
<p class="m-0 text-center text-white">Copyright © Health Check 2018</p>
</div>
<!-- /.container -->
</footer>
<!-- Bootstrap core JavaScript -->
<script src="vendor/jquery/jquery.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Plugin JavaScript -->
<script src="vendor/jquery-easing/jquery.easing.min.js"></script>
<!-- Custom JavaScript for this theme -->
<script src="js/scrolling-nav.js"></script>
</body>
</html>