-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.php
53 lines (42 loc) · 1.27 KB
/
action.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
<?php
include "inc/account.html";
$mysqli = new mysqli("localhost", "root", "root","hospital");
if ($mysqli->connect_error) {
die("Connection failed: " . $mysqli->connect_error);
}
session_start();
$name=mysqli_escape_string($_POST['name']);
$add=mysqli_escape_string($_POST['address']);
$mobile=mysqli_escape_string($_POST['mobile']);
$dept=mysqli_escape_string($_POST['dept']);
$appoint=mysqli_escape_string($_POST['adate']);
$time=mysqli_escape_string($_POST['time']);
$gender=mysqli_escape_string($_POST['gen']);
$email=mysqli_escape_string($_POST['e-mail']);
$_SESSION['pemail']=$email;
$query=mysqli_query($mysqli,"INSERT INTO patient VALUES ('{$name}', '{$add}', '{$mobile}', '{$dept}', '{$appoint}','{$time}','{$gender}','{$email}')");
if ($query) {
echo "<br>Sucessful Booking of Appointment";
$query="Select name,dept,apt_date,time from patient where mobile='{$mobile}'";
$result=mysqli_query($mysqli,$query);
echo"<table>
<tr>
<th>Patient Name</th>
<th>Department</th>
<th>Appointment Date</th>
<th>Appointment Time</th>
</tr>";
while($row=mysqli_fetch_row($result)){
echo "<tr>
<td>$row[0]</td>
<td>$row[1]</td>
<td>$row[2]</td>
<td>$row[3]</td>
</tr>";
}
echo"</table>";
}
else {
echo "<br>Your Registery already exists or Appointment can not be booked";
}
?>