-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconnect.php
43 lines (42 loc) · 1.52 KB
/
connect.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
<?php
$servername="localhost";
$username="root";
$password="";
$database="donorform";
$conn=mysqli_connect($servername,$username,$password,$database);
if($_SERVER['REQUEST_METHOD']=="POST"){
$firstname=$_POST['firstname'];
$lastname=$_POST['lastname'];
$Age=$_POST['Age'];
$dob=$_POST['dob'];
$gender=$_POST['gender'];
$bloodgroup=$_POST['bloodgroup'];
$Email=$_POST['Email'];
$Mobile=$_POST['Mobile'];
$password=$_POST['password'];
$cpassword=$_POST['cpassword'];
$city=$_POST['city'];
$state=$_POST['state'];
$zip=$_POST['zip'];
$blooddate=$_POST['blooddate'];
$vaccinedate=$_POST['vaccinedate'];
$donateblood=$_POST['donateblood'];
$covidnegative=$_POST['covidnegative'];
if($password==$cpassword)
{
$sql="INSERT INTO `user` (`firstname`, `lastname`, `Age`, `dob`, `gender`,
`bloodgroup`, `Email`, `Mobile`, `password`, `city`, `state`,
`zip`, `blooddate`, `vaccinedate`, `donateblood`, `covidnegative`)
VALUES (' $firstname', '$lastname', '$Age', '$dob', '$gender',
'$bloodgroup', '$Email', '$Mobile', ' $password', '$city',
'$state', '$zip', '$blooddate', '$vaccinedate', '$donateblood',
' $covidnegative')";
$result=mysqli_query($conn,$sql);
if($result){
echo"<br>record was inserted successfully";
}
else{
echo"<br>Record was not inserted successfully because of this error--->".mysqli_error($conn);
}
}
}