forked from Chandana047/Blood-Bank-Management-System
-
Notifications
You must be signed in to change notification settings - Fork 14
/
abs.php
115 lines (102 loc) · 3.99 KB
/
abs.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
<?php
session_start();
require 'file/connection.php';
if(isset($_GET['search'])){
$searchKey = $_GET['search'];
$sql = "select bloodinfo.*, hospitals.* from bloodinfo, hospitals where bloodinfo.hid=hospitals.id && bg='$searchKey'";
}else{
$sql = "select bloodinfo.*, hospitals.* from bloodinfo, hospitals where bloodinfo.hid=hospitals.id";
}
$result = mysqli_query ($conn, $sql);
?>
<!DOCTYPE html>
<html>
<?php $title="Bloodbank | Available Blood Samples"; ?>
<?php require 'head.php'; ?>
<style>
body{
background-size: cover;
min-height: 0;
height: 900px;
}
.login-form{
width: calc(100% - 20px);
max-height: 650px;
max-width: 450px;
background-color: white;
}
</style>
<body>
<?php require 'header.php'; ?>
<div class="container cont">
<?php require 'message.php'; ?>
<div class="row col-lg-8 col-md-8 col-sm-12 mb-3">
<form method="get" action="" style="margin-top:-20px; ">
<label class="font-weight-bolder">Select Blood Group:</label>
<select name="search" class="form-control">
<option><?php echo @$_GET['search']; ?></option>
<option value="A+">A+</option>
<option value="A-">A-</option>
<option value="B+">B+</option>
<option value="B-">B-</option>
<option value="AB+">AB+</option>
<option value="AB-">AB-</option>
<option value="O+">O+</option>
<option value="O-">O-</option>
</select><br>
<a href="abs.php" class="btn btn-info mr-4"> Reset</a>
<input type="submit" name="submit" class="btn btn-info" value="search">
</form>
</div>
<table class="table table-responsive table-striped rounded mb-5">
<tr><th colspan="7" class="title">Available Blood Samples</th></tr>
<tr>
<th>#</th>
<th>Hospital Name</th>
<th>Hospital City</th>
<th>Hospital Email</th>
<th>Hospital Phone</th>
<th>Blood Group</th>
<th>Action</th>
</tr>
<div>
<?php
if ($result) {
$row =mysqli_num_rows( $result);
if ($row) { //echo "<b> Total ".$row." </b>";
}else echo '<b style="color:white;background-color:red;padding:7px;border-radius: 15px 50px;">Nothing to show.</b>';
}
?>
</div>
<?php while($row = mysqli_fetch_array($result)) { ?>
<tr>
<td><?php echo ++$counter;?></td>
<td><?php echo $row['hname'];?></td>
<td><?php echo ($row['hcity']); ?></td>
<td><?php echo ($row['hemail']); ?></td>
<td><?php echo ($row['hphone']); ?></td>
<td><?php echo ($row['bg']); ?></td>
<?php $bid= $row['bid'];?>
<?php $hid= $row['hid'];?>
<?php $bg= $row['bg'];?>
<form action="file/request.php" method="post">
<input type="hidden" name="bid" value="<?php echo $bid; ?>">
<input type="hidden" name="hid" value="<?php echo $hid; ?>">
<input type="hidden" name="bg" value="<?php echo $bg; ?>">
<?php if (isset($_SESSION['hid'])) { ?>
<td><a href="javascript:void(0);" class="btn btn-info hospital">Request Sample</a></td>
<?php } else {(isset($_SESSION['rid'])) ?>
<td><input type="submit" name="request" class="btn btn-info" value="Request Sample"></td>
<?php } ?>
</form>
</tr>
<?php } ?>
</table>
</div>
<?php require 'footer.php' ?>
</body>
<script type="text/javascript">
$('.hospital').on('click', function(){
alert("Hospital user can't request for blood.");
});
</script>