-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconnect.php
33 lines (32 loc) · 921 Bytes
/
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
<?php
$firstname= filter_input(INPUT_POST,'firstname');
$lastname= filter_input(INPUT_POST,'lastname');
$username= filter_input(INPUT_POST,'username');
$city= filter_input(INPUT_POST,'city');
$state= filter_input(INPUT_POST,'state');
$zip= filter_input(INPUT_POST,'username');
$address= filter_input(INPUT_POST,'username');
$host="localhost";
$dbusername="root";
$dbpassword="";
$dbname="Volunteers";
$conn= new mysqli($host , $dbusername ,$dbpassword ,$dbname);
if (mysqli_connect_error())
{
die('Connect Error ('.mysqli_connect_errno().')'.mysqli_connect_error());
}
else
{
$sql="INSERT INTO account(firstname,lastname,username,city ,state,zip,address)
values('$firstname',$lastname,$username,$city,$state,$zip,$address')" ;
if($conn->query($sql))
{
echo "New record is registered succesfully";
}
else{
echo "Error: ".$sql."<br>".$conn->error ;
}
conn->close();
}
}
?>