-
Notifications
You must be signed in to change notification settings - Fork 0
/
edit_prescription.php
78 lines (72 loc) · 2.23 KB
/
edit_prescription.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
<?php
ob_start();
include 'connection.php';
include 'doctorheader.php';
include 'css/style.css';
session_start();
$docname = $_SESSION['login'];
$pid = $_SESSION['pid'];
$sl = $_SESSION['sl'];
$sql = "select name,phone from registration where email = '$pid'";
$result = $conn->query($sql);
if($row = $result->fetch_assoc()){
?>
<html>
<title>Prescribe</title>
<body>
<?php include 'back_btn.php'; ?>
<table id="list" style="margin-top:50px;">
<tr>
<th>Id</th>
<th>Name</th>
<th>Phone</th>
<th>Problems</th>
<th>Medicines</th>
</tr>
<tr>
<td><?php echo $sl; ?></td>
<td><?php echo $row['name']; ?></td>
<td><?php echo $row['phone']; ?></td>
<?php
//echo $sl;
//echo $docname;
//echo $pid;
$sql2= "select * from consultation where id='$sl' && doctor_name='$docname' && user_email='$pid'";
$result2 = $conn->query($sql2);
if($row2 = $result2->fetch_assoc()){
?>
<td><?php echo $row2['problems']; ?></td>
<td><?php echo $row2['medicine']; ?></td>
</tr>
</table>
<div class="div-center">
<form id="p" name="p" method="post">
<table style="margin-top:50px;">
<tr>
<td><textarea name="p"><?php echo $row2['prescription']; ?></textarea></td>
</tr>
<tr>
<td id="center"><input type="submit" name="submit" value="Update"></td>
</tr>
<tr>
<td id="center">
<?php
if(isset($_POST['submit'])){
$p = $_POST['p'];
$sql3 = "update consultation set prescription = '$p',status ='done' where id='$sl'";
$result3 = $conn->query($sql3);
if($result3){
echo 'completed<br>';
echo "<a id='a' href = 'view_prescription.php'>Back to List</a>";
}
}
}
}
?>
</td>
</tr>
</table>
</form>
</div>
</body>
</html>