-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathappointmentdetail.php
123 lines (112 loc) · 3.52 KB
/
appointmentdetail.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
<?php
session_start();
include("dbconnection.php");
if(isset($_POST[submitapp]))
{
$sql ="INSERT INTO appointment(appointmenttype,roomid,departmentid,appointmentdate,appointmenttime,doctorid) values('$_POST[select]','$_POST[select2]','$_POST[select3]','$_POST[date]','$_POST[time]','$_POST[select5]')";
if($qsql = mysqli_query($con,$sql))
{
echo "<script>alert('appointment record inserted successfully...');</script>";
}
else
{
echo mysqli_error($con);
}
}
if(isset($_GET[editid]))
{
$sql="SELECT * FROM appointment WHERE appointmentid='$_GET[editid]' ";
$qsql = mysqli_query($con,$sql);
$rsedit = mysqli_fetch_array($qsql);
}
$sqlappointment1 = "SELECT max(appointmentid) FROM appointment where patientid='$_GET[patientid]' AND (status='Active' OR status='Approved')";
$qsqlappointment1 = mysqli_query($con,$sqlappointment1);
$rsappointment1=mysqli_fetch_array($qsqlappointment1);
$sqlappointment = "SELECT * FROM appointment where appointmentid='$rsappointment1[0]'";
$qsqlappointment = mysqli_query($con,$sqlappointment);
$rsappointment=mysqli_fetch_array($qsqlappointment);
if(mysqli_num_rows($qsqlappointment) == 0)
{
echo "<center><h2>No Appointment records found..</h2></center>";
}
else
{
$sqlappointment = "SELECT * FROM appointment where appointmentid='$rsappointment1[0]'";
$qsqlappointment = mysqli_query($con,$sqlappointment);
$rsappointment=mysqli_fetch_array($qsqlappointment);
$sqlroom = "SELECT * FROM room where roomid='$rsappointment[roomid]' ";
$qsqlroom = mysqli_query($con,$sqlroom);
$rsroom =mysqli_fetch_array($qsqlroom);
$sqldepartment = "SELECT * FROM department where departmentid='$rsappointment[departmentid]'";
$qsqldepartment = mysqli_query($con,$sqldepartment);
$rsdepartment =mysqli_fetch_array($qsqldepartment);
$sqldoctor = "SELECT * FROM doctor where doctorid='$rsappointment[doctorid]'";
$qsqldoctor = mysqli_query($con,$sqldoctor);
$rsdoctor =mysqli_fetch_array($qsqldoctor);
?>
<table class="table table-bordered table-striped">
<tr>
<td>Department</td>
<td> <?php echo $rsdepartment[departmentname]; ?></td>
</tr>
<tr>
<td>Doctor</td>
<td> <?php echo $rsdoctor[doctorname]; ?></td>
</tr>
<tr>
<td>Appointment Date</td>
<td> <?php echo date("d-M-Y",strtotime($rsappointment[appointmentdate])); ?></td>
</tr>
<tr>
<td>Appointment Time</td>
<td> <?php echo date("h:i A",strtotime($rsappointment[appointmenttime])); ?></td>
</tr>
</table>
<?php
}
?>
<script type="application/javascript">
function validateform()
{
if(document.frmappntdetail.select.value == "")
{
alert("Appointment type should not be empty..");
document.frmappntdetail.select.focus();
return false;
}
else if(document.frmappntdetail.select2.value == "")
{
alert("Room type should not be empty..");
document.frmappntdetail.select2.focus();
return false;
}
else if(document.frmappntdetail.select3.value == "")
{
alert("Department name should not be empty..");
document.frmappntdetail.select3.focus();
return false;
}
else if(document.frmappntdetail.date.value == "")
{
alert("Appointment date should not be empty..");
document.frmappntdetail.date.focus();
return false;
}
else if(document.frmappntdetail.time.value == "")
{
alert("Appointment time should not be empty..");
document.frmappntdetail.time.focus();
return false;
}
else if(document.frmappntdetail.select5.value == "")
{
alert("Doctor name should not be empty..");
document.frmappntdetail.select5.focus();
return false;
}
else
{
return true;
}
}
</script>