forked from Shivangibohara/lifeline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hos.php
190 lines (152 loc) · 5.2 KB
/
hos.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<?php
session_start();
$servername = "localhost";
$username = "root";
$password= "";
$dbname = "login";
// Create connection
$conn = mysqli_connect($servername, $username, $password,$dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
if(isset($_POST['submit'])){
$Name = $_POST['Name'];
$Need = $_POST['Need'];
$Email = $_POST['Email'];
$_SESSION['Need']=$Need;
if($Name=="KAMLA NEHRU MEMORIAL HOSPITAL"){
$c = "SELECT Name FROM hospital WHERE Name = 'KAMLA NEHRU MEMORIAL HOSPITAL'";
$result = mysqli_query($conn,$c);
if(mysqli_num_rows($result) == 0) {
$ins = "INSERT INTO `hospital`(`Name`, `Need`, `Email`) VALUES ('$Name',$Need,'$Email')";
if ($conn->query($ins) == true){
echo "";
}
else {
echo "ERROR: $ins <br> $conn->error";
}
}
else {
$sql = "UPDATE hospital SET hospital.Need = hospital.Need + $Need WHERE Name = 'KAMLA NEHRU MEMORIAL HOSPITAL'";
mysqli_query($conn,$sql);
}
}
if($Name=="SWAROOP RANI NEHRU HOSPITAL"){
$d = "SELECT Name FROM hospital WHERE Name = 'SWAROOP RANI NEHRU HOSPITAL'";
$result2 = mysqli_query($conn,$d);
if(mysqli_num_rows($result2) == 0) {
$ins2 = "INSERT INTO `hospital`(`Name`, `Need`, `Email`) VALUES ('$Name',$Need,'$Email')";
if ($conn->query($ins2) == true){
echo "";
} else {
echo "ERROR: $ins2 <br> $conn->error";
}
}
else {
$sql2 = "UPDATE hospital SET hospital.Need = hospital.Need + $Need WHERE Name = 'SWAROOP RANI NEHRU HOSPITAL'";
mysqli_query($conn,$sql2);
}
}
if($Name=="DUFFERIN HOSPITAL"){
$d = "SELECT Name FROM hospital WHERE Name = 'DUFFERIN HOSPITAL'";
$result2 = mysqli_query($conn,$d);
if(mysqli_num_rows($result2) == 0) {
$ins2 = "INSERT INTO `hospital`(`Name`, `Need`, `Email`) VALUES ('$Name',$Need,'$Email')";
if ($conn->query($ins2) == true){
echo "";
} else {
echo "ERROR: $ins2 <br> $conn->error";
}
}
else {
$sql2 = "UPDATE hospital SET hospital.Need = hospital.Need + $Need WHERE Name = 'DUFFERIN HOSPITAL'";
mysqli_query($conn,$sql2);
}
}
if($Name=="MOTILAL NEHRU HOSPITAL"){
$d = "SELECT Name FROM hospital WHERE Name = 'MOTILAL NEHRU HOSPITAL'";
$result2 = mysqli_query($conn,$d);
if(mysqli_num_rows($result2) == 0) {
$ins2 = "INSERT INTO `hospital`(`Name`, `Need`, `Email`) VALUES ('$Name',$Need,'$Email')";
if ($conn->query($ins2) == true){
echo "";
} else {
echo "ERROR: $ins2 <br> $conn->error";
}
}
else {
$sql2 = "UPDATE hospital SET hospital.Need = hospital.Need + $Need WHERE Name = 'MOTILAL NEHRU HOSPITAL'";
mysqli_query($conn,$sql2);
}
}
if($Name=="NAZRETH HOSPITAL"){
$d = "SELECT Name FROM hospital WHERE Name = 'NAZRETH HOSPITAL'";
$result2 = mysqli_query($conn,$d);
if(mysqli_num_rows($result2) == 0) {
$ins2 = "INSERT INTO `hospital`(`Name`, `Need`, `Email`) VALUES ('$Name',$Need,'$Email')";
if ($conn->query($ins2) == true){
echo "";
} else {
echo "ERROR: $ins2 <br> $conn->error";
}
}
else {
$sql2 = "UPDATE hospital SET hospital.Need = hospital.Need + $Need WHERE Name = 'NAZRETH HOSPITAL'";
mysqli_query($conn,$sql2);
}
}
}
// code for email
if($Name=="KAMLA NEHRU MEMORIAL HOSPITAL"){
$to_email = "[email protected]";
$subject = "REQUIREMENT!!!!";
$body = "Requirement of ".$Need." oxygen cylinder in ".$Name;
$headers = "From: [email protected]";
if (mail($to_email, $subject, $body, $headers)) {
echo "Success! Your entry has been submitted successfully";
} else {
echo "Email sending failed...";}
}
if($Name=="SWAROOP RANI NEHRU HOSPITAL"){
$to_email = "[email protected]";
$subject = "REQUIREMENT!!!!";
$body = "Requirement of ".$Need." oxygen cylinder in ".$Name;
$headers = "From: [email protected]";
if (mail($to_email, $subject, $body, $headers)) {
echo "Success! Your entry has been submitted successfully";
} else {
echo "Email sending failed...";}
}
if($Name=="DUFFERIN HOSPITAL"){
$to_email = "[email protected]";
$subject = "REQUIREMENT!!!!";
$body = "Requirement of ".$Need." oxygen cylinder in ".$Name;
$headers = "From: [email protected]";
if (mail($to_email, $subject, $body, $headers)) {
echo "Success! Your entry has been submitted successfully";
} else {
echo "Email sending failed...";}
}
if($Name =="MOTILAL NEHRU HOSPITAL"){
$to_email = "[email protected]";
$subject = "REQUIREMENT!!!!";
$body = "Requirement of ".$Need." oxygen cylinder in ".$Name;
$headers = "From: [email protected]";
if (mail($to_email, $subject, $body, $headers)) {
echo "Success! Your entry has been submitted successfully";
} else {
echo "Email sending failed...";}
}
if($Name=="NAZRETH HOSPITAL"){
$to_email = "[email protected]";
$subject = "REQUIREMENT!!!!";
$body = "Requirement of ".$Need." oxygen cylinder in ".$Name;
$headers = "From: [email protected]";
if (mail($to_email, $subject, $body, $headers)) {
echo "Success! Your entry has been submitted successfully";
} else {
echo "Email sending failed...";}
}
mysqli_close($conn);
?>