-
Notifications
You must be signed in to change notification settings - Fork 2
/
adminroomallocationconf.php
43 lines (35 loc) · 1.37 KB
/
adminroomallocationconf.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<?php
require_once('hospitaldb_connect.php');
session_start();
if (!isset($_SESSION['admin_id'])) {
header("Location: adminsigninpage.php");
exit;
}
if (isset($_POST['p_email']) && isset($_POST['room_no']) && isset($_POST['start_date']) && isset($_POST['end_date'])) {
$p_email = $_POST['p_email'];
$room_no = $_POST['room_no'];
$start_date = $_POST['start_date'];
$end_date = $_POST['end_date'];
$p_name_query = "SELECT name from patients where email = '$p_email'";
$p_name_result = mysqli_query($connection, $p_name_query);
$p_name = mysqli_fetch_assoc($p_name_result)['name'];
$sql = "INSERT INTO allocated_rooms VALUES ('$p_email', '$p_name', '$room_no', '$start_date', '$end_date')";
$sql_result = mysqli_query($connection, $sql);
if (mysqli_affected_rows($connection)) {
header("Location: admindashboard.php");
exit;
} else {
echo "Room Allocation Failed!";
}
}
?>
</body>
</html>