-
Notifications
You must be signed in to change notification settings - Fork 1
/
doctor.php
69 lines (63 loc) · 2.35 KB
/
doctor.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
<?php
session_start();
include_once("config.php");
$count=0;
$query = "SELECT * from patients WHERE Doctor_Allotted='{$_session['dname']}' AND Admission='0'";
$result = mysqli_query($conn,$query) or die(mysqli_error($conn));;
if(mysqli_num_rows($result)>0){
while ($row =mysqli_fetch_array($result)){
$count++;
}
}
echo "Patients Left:"; echo $count ;
?><button name="Logout" type="submit" id="Logout" onclick="logout.php"></button>
<?php
$query = "SELECT * from patients WHERE Doctor_Allotted='{$_session['dname']}'";
$result = mysqli_query($conn,$query) or die(mysqli_error($conn));;
if(mysqli_num_rows( $result)>0){
while ($row =mysqli_fetch_array($result)){
echo nl2br("\n\nName:") ; echo $row['Name'];
echo nl2br("\nAge:") ; echo $row['Age'];
echo nl2br("\nSex:") ; echo $row['Sex'];
echo nl2br("\nContact:"); echo $row['Contact'];
//echo nl2br("<tr><td>".$row['Name']."</td><td> ".$row['Age']."</td><td> ".$row['Contact']."</td><td> ".$row['Sex']."</td></tr>\n");
$_session['pid']=$row['pid'];
echo $_session['pid'];
?>
<head>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<div class="container">
<form id="contact" action="doctor.php" method="post">
<fieldset>
<input placeholder="Prescription" type="text" tabindex="1" required autofocus>
</fieldset>
Admission Required:
<select name="Admission" required>
<option value="Male">Yes</option>
<option value="Female">No</option>
</select> <br>
<fieldset>
<button name="submit" type="submit" id="contact-submit" data-submit="...Sending">Submit</button>
</fieldset>
</form>
</div>
<br><br>
<?php
}
}
if(isset($_POST['submit'])){
if(isset($_session['pid'])){
if($_POST['Admission']=="Yes"){
$sql = "UPDATE patients Set Admission='1' WHERE pid='{$_session['pid']}'";
$result = mysqli_query($conn,$sql) or die(mysqli_error($conn));
}
else{
$sql = "DELETE FROM patients WHERE pid='{$_session['pid']}'";
$result = mysqli_query($conn,$sql) or die(mysqli_error($conn));
$sql = "UPDATE patients Set Admission='0' WHERE pid='{$_session['pid']}'";
$result = mysqli_query($conn,$sql) or die(mysqli_error($conn));
}
}
}
?>