-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontribute.php
More file actions
33 lines (26 loc) · 778 Bytes
/
Copy pathcontribute.php
File metadata and controls
33 lines (26 loc) · 778 Bytes
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
$server = "localhost";
$user = "root";
$pass = "";
$dbname = "feedback";
//Creating connection for mysqli
$conn = new mysqli($server, $user, $pass, $dbname);
//Checking connection
if($conn->connect_error){
die("Connection failed:" . $conn->connect_error);
}
$name = mysqli_real_escape_string($conn, $_POST['name']);
$mobile = $_POST['mobile'];
$email = mysqli_real_escape_string($conn, $_POST['email']);
$book = mysqli_real_escape_string($conn, $_POST['book']);
$sql = "INSERT INTO contribute (name, mobile, email, book) VALUES ('$name', '$mobile', '$email', '$book')";
if($conn->query($sql) === TRUE){
echo "<h1>Record Added Sucessfully</h1>";
header("refresh:1; thanks2.html");
}
else
{
echo "Error" . $sql . "<br/>" . $conn->error;
}
$conn->close();
?>