-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuserinfo.php
49 lines (41 loc) · 1.01 KB
/
userinfo.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
<?php
$name = filter_input(INPUT_POST, 'name');
$email = filter_input(INPUT_POST, 'email');
$phone = filter_input(INPUT_POST, 'phone');
$category = filter_input(INPUT_POST, 'category');
$message = filter_input(INPUT_POST, 'message');
$host = "localhost";
$dbusername = "root";
$dbpassword = "";
$dbname = "quizdatabase";
// Create connection
$conn = new mysqli ($host, $dbusername, $dbpassword, $dbname);
if($conn){
echo "Connection Successful";
}else{
echo "No Connection";
}
if (mysqli_connect_error()){
die('Connect Error ('. mysqli_connect_errno() .') '
. mysqli_connect_error());
}
else{
$sql = "INSERT INTO custreview(name, email, phone, category, message) values('$name','$email','$phone', '$category', '$message')";
if ($conn->query($sql)){
echo "New record is inserted sucessfully";
}
else{
echo "Error: ". $sql ."
". $conn->error;
}
$conn->close();
}
header('location:index.html');
?>
<html>
<head>
<meta http-equiv = "refresh" content = "2"; url = "./index.php" />
</head>
<body>
</body>
</html>