-
Notifications
You must be signed in to change notification settings - Fork 1
/
SendRequest.php
145 lines (133 loc) · 3.35 KB
/
SendRequest.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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<style>
p{
color:red;
text-align:center;
font-size:20px;
font-weight:bold;
}
body{
margin:0;
padding:0;
}
.image{
margin:0;
padding:0;
}
#slide{
margin-left:100px;
}
#slide1{
margin-left:110px;
}
#slide2{
margin-left:34px;
}
#slide3{
margin-left:100px;
}
#slide4{
margin-left:50px;
}
#out{
margin-left:150px;
margin-right:150px;
}
#fill{
border:2px solid red;
width:1000px;
padding:10px;
margin:20px;
}
.image{
margin:0;
padding:0;
}
.navbar{
overflow:hidden;
background-color:#333;
font-family:'PT Sans', sans-serif;
}
.navbar a{
float:left;
display:block;
color:white;
text-align:center;
padding:14px 20px;
text-decoration:none;
}
.navbar a:hover{
background-color:#ddd;
color:black;
}
</style>
<body>
<div class="image">
<img src="img2.jpg" height="400" width="1390">
<div class="navbar">
<a href="Home.php">Home</a>
<a href="Search.php">Search</a>
<a href="SendRequest.php">Send Request</a>
<a href="View_Request.php">View Request</a>
<a href="LogIn.php">Log In</a>
<a href="About.php">Contact Us</a>
</div>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
<div id="out">
<div id="fill">
<div id="fillin" style="text-align:center">
<h2 style="color:red">BLOOD REQUEST</h2>
<b>Name</b><input type="text" placeholder="Enter Email" name="names" style="width:200px" id="slide" required></br></br>
<b>Blood Group</b><input list="bloodtypes" name="bloodtype" style="width:200px" id="slide4" required></br></br>
<datalist id="bloodtypes">
<option>A+</option>
<option>A-</option>
<option>B+</option>
<option>B-</option>
<option>O+</option>
<option>O-</option>
<option>AB+</option>
<option>AB-</option>
</datalist>
<b>Units</b><input type="number" placeholder="No of Units needed" name="unit" style="width:200px" id="slide1" required></br></br>
<b>Mobile Number</b><input type="text" placeholder="Enter 10 digit mobile number" name="mobile_number" style="width:200px" id="slide2" required></br></br>
<b>Email</b><input type="text" placeholder="Enter Email" name="email" style="width:200px" id="slide3" required></br></br>
<input type="submit" value="Submit" name="sub"></br></br>
</div>
</div>
</div>
</form>
</div>
<?php
$servername = "localhost";
$username = "root";
$password = "aa";
$dbname = "bloodbank";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname, 3308);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$name= $bloodgroup= $units= $mobilenumber= $email="";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = $_POST["names"];
$bloodgroup = $_POST["bloodtype"];
$units = $_POST["unit"];
$mobilenumber = $_POST["mobile_number"];
$email = $_POST["email"];
$sql = "INSERT INTO sendrequest (Name, BloodGroup,Units, MobileNumber, Email)
VALUES ('$name','$bloodgroup','$units' ,'$mobilenumber','$email')";
if (mysqli_query($conn, $sql)) {
echo "<p>REQUEST SUBMITTED SUCCESSFULLY!</p>";
}else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
}
?>
</body>
</html>