forked from anjali9265/Online-clinic-booking
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathview_app.php
155 lines (143 loc) · 4.31 KB
/
view_app.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
<?php
session_start();
if(empty($_SESSION["user"]))
header("Location:index.php");
?>
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
$(".btn[data-target='#myModal']").click(function() {
var columnHeadings = $("thead th").map(function() {
return $(this).text();
}).get();
columnHeadings.pop();
var columnValues = $(this).parent().siblings().map(function() {
return $(this).text();
}).get();
var modalBody = $('<div id="modalContent"></div>');
var modalForm = $('<form role="form" name="modalForm" action="putYourPHPActionHere.php" method="post"></form>');
$.each(columnHeadings, function(i, columnHeader) {
var formGroup = $('<div class="form-group"></div>');
formGroup.append('<label for="'+columnHeader+'">'+columnHeader+'</label>');
formGroup.append('<input class="form-control" name="'+columnHeader+i+'" id="'+columnHeader+i+'" value="'+columnValues[i]+'" />');
modalForm.append(formGroup);
});
modalBody.append(modalForm);
$('.modal-body').html(modalBody);
});
$('.modal-footer .btn-primary').click(function() {
$('form[name="modalForm"]').submit();
});
</script>
<title>Appointments</title>
<!--Navigation bar-->
<style>
.modal iframe {
width: 100%;
height: 100%;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover {
background-color: #111;
}
</style>
<!--end of nav-->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<body>
<ul>
<li><a class="active" href="doc_slot.php">Back</a></li>
<li><a href="logout.php">Logout</a></li>
</ul>
<br>
<br><center>
<h1>Appointments</h1></center>
<br>
<br>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th class="">Slot</th>
<th class="">Name</th>
<th class="">Age</th>
<th class="">Details</th>
</tr>
</thead>
<tbody>
<?php
include "connection.php";
$date=$_GET['varname'];
$sql="SELECT `id`, `name`,`age`,`slot` FROM `patient` WHERE `slot_date`='$date' ORDER BY `slot`";
$result=mysqli_query($connection,$sql);
if(($var=mysqli_num_rows($result))==0){
echo'<script type="text/javascript">
alert("No record found");
window.location.href = "doc_slot.php";
</script>';
}
while ($temp=mysqli_fetch_array($result)){
$id=$temp['id']; ?>
<tr>
<td>
<?php echo $temp['slot'];?>
</td>
<td>
<?php echo $temp['name'];?>
</td>
<td>
<?php echo $temp['age'];?>
</td>
<td style="text-align:center;">
<button class="btn btn-success" data-toggle="modal" data-target="#myModal" contenteditable="false">Edit</button>
</td>
</tr>
<?php
} ?>
</tbody>
</table>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content"></div>
</div>
<div class="modal-dialog">
<div class="modal-content"></div>
</div>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"> <span aria-hidden="true" class="">× </span><span class="sr-only">Close</span>
</button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
<iframe src="view.php?id=<?php echo $id ?>" />
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</body>
</html>