-
Notifications
You must be signed in to change notification settings - Fork 0
/
donate.php
194 lines (170 loc) · 6.66 KB
/
donate.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
191
192
193
194
<!--
Author: Colorlib
Author URL: https://colorlib.com
License: Creative Commons Attribution 3.0 Unported
License URL: http://creativecommons.org/licenses/by/3.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>Donate</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="application/x-javascript">
addEventListener("load", function () {
setTimeout(hideURLbar, 0);
}, false);
function hideURLbar() {
window.scrollTo(0, 1);
}
</script>
<!-- Custom Theme files -->
<link href="style.css" rel="stylesheet" type="text/css" media="all" />
<!-- //Custom Theme files -->
<!-- web font -->
<link href="//fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<!-- //web font -->
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
<div class="navbar-collapse collapse w-100 order-1 order-md-0 dual-collapse2">
<span class="navbar-brand mb-0 h1">Hospital</span>
</div>
<!-- <div class="mx-auto order-0">
<a class="navbar-brand mx-auto" href="#">Navbar 2</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".dual-collapse2">
<span class="navbar-toggler-icon"></span>
</button>
</div> -->
<div class="navbar-collapse collapse w-100 order-3 dual-collapse2">
<ul class="navbar-nav ml-auto">
</ul>
</div>
</nav>
<?php
$na=$em=$ty=$dct="";
$status=true;
if(!empty($_POST))
{
if(!empty($_POST["name"]))
{
$na=$_POST["name"];
}
else{
$status=false;
}
if(!empty($_POST["email"]))
{
$em=$_POST["email"];
}
else{
$status=false;
}
if(!empty($_POST["type"]))
{
$ty=$_POST["type"];
}
else{
$status=false;
}
if(!empty($_POST["dcity"]))
{
$dct=$_POST["dcity"];
}
else{
$status=false;
}
//db connection
$servername="localhost";
$username="root";
$password="";
$dbname="electrothon";
$conn=new mysqli($servername,$username,$password,$dbname);
if($conn->connect_error)
{
die("Connection failed".$conn->connect_error);
}
else{
if($status)
{
$sql= "INSERT INTO donor (name ,email, type, dcity) values('$na','$em','$ty','$dct') " ;
if($conn->query($sql)){
header('Location: thank.html');
}
else{
echo "Error:".$sql."<br>".$conn->error;
}
$conn->close();
}
}
}
?>
<br><br>
<h1 style="text-align:center">Blood Supplies</h1><br><br>
<!-- main html -->
<!-- <div >
<div >
<div>
<form action="#" method="post">
<input class="text" type="text" name="name" placeholder="Name" required autofocus>
<input class="text email" type="email" name="email" placeholder="Email" required>
<input class="text email" type="text" name="dcity" placeholder="City" required>
<select name="type">
<option value="A+">A+</option>
<option value="A-">A-</option>
<option value="B+">B+</option>
<option value="B-">B-</option>
<option value="O+">O+</option>
<option value="O-">O-</option>
<option value="AB+">AB+</option>
<option value="AB-">AB-</option>
</select>
<div class="wthree-text">
<div class="clear"> </div>
</div>
<input type="submit" value="SIGNUP">
</form>
</div>
</div>
</div> -->
<form method="POST" class="form-inline" style="margin-left:32em;">
<div class="form-group">
<input class="form-control mr-sm-2" name="name" type="search" placeholder="Name"
aria-label="Search">
</div>
<div class="form-group">
<input class="form-control mr-sm-2" name="email" type="email" placeholder="E-mail"
aria-label="Search">
</div>
<div class="form-group">
<input class="form-control mr-sm-2" name="dcity" type="search" placeholder="City"
aria-label="Search">
</div>
<div class="form-group">
<select style="margin-right:10px;" name="type" class="form-control" id="exampleFormControlSelect1">
<option value="A+">A+</option>
<option value="A-">A-</option>
<option value="B+">B+</option>
<option value="B-">B-</option>
<option value="O+">O+</option>
<option value="O-">O-</option>
<option value="AB+">AB+</option>
<option value="AB-">AB-</option>
</select>
</div>
<button class="btn btn-outline-success my-2 my-sm-0" name="add" type="submit">Submit</button>
</form>
<!-- //main -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous">
</script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous">
</script>
</body>
</html>