-
Notifications
You must be signed in to change notification settings - Fork 2
/
bloodDonate.php
28 lines (27 loc) · 924 Bytes
/
bloodDonate.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
<?php
session_start();
include "./DB/DbConnection.php";
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$query='SELECT * FROM DONOR WHERE DONOR.dId="'.$_POST['dId'].'"';
$result = mysqli_query($connection,$query);
$_POST['donationDate']=date("Y-m-d");
if(mysqli_num_rows($result)>0){
while ($row = mysqli_fetch_array($result)) {
if($row['dFname']==$_POST['dFname'] && $row['dLname']==$_POST['dLname']){
if($row['DBloodGroup']==$_POST['DBloodGroup']){
$sql='INSERT INTO blood VALUES ("'.$_POST['bId'].'","'.$_POST['bType'].'","'.$_POST['donationDate'].'","'.$_POST['dId'].'")';
echo $sql."<br><br>";
mysqli_query($connection,$sql);
echo "<br><br>";
echo mysqli_error($connection);
}
else echo "Blood Group doesn't matches";
}
else echo "Name entered doesn't matches with the donor's name";
}
}
else{
echo"did doesn't exist";
}
}
?>