-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathnewDonation.php
28 lines (25 loc) · 946 Bytes
/
newDonation.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();
$_SESSION["tab"] = "New Donation";
if($_SESSION["login"] != 1)
echo '<h2 txtcolor="red">Authentication Error!!!</h2>';
else{
include_once('header.php');
$pid = $_POST['pid'];
$units = $_POST['units'];
date_default_timezone_set("Asia/Calcutta");
$date = date('y-m-d');
$time = date('h:i');
$sql_1 = "insert into Donation (p_id, d_date, d_time, d_quantity) values('$pid', '$date', '$time', '$units')";
$sql_2 = "update Stock SET s_quantity = s_quantity + '$units' where Stock.s_blood_group = (select p_blood_group FROM Person where p_id = '$pid')";
if (($con->query($sql_1) === TRUE) and ($con->query($sql_2) === TRUE)) {
###########contents of div goes here###########
echo 'your donation is succesful';
###############################################
}
else {
echo "Error: " . $sql . "<br>" . $con->error;
}
include_once('footer.php');
}
?>