-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconnect.php
52 lines (40 loc) · 994 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
$name=$_POST["name"];
$email= $_POST["email"];
$message=$_POST["message"];
if(!empty($name)){
if(!empty($email)){
if(!empty($message)){
$host="localhost";
$dbusername="root";
$dbpassword="";
$dbname="test";
$conn=new mysqli($host,$dbusername,$dbpassword,$dbname);
if(mysqli_connect_error()){
die('Connect Error('.mysqli_connect_errno().')'
.mysqli_connect_error());
}
else{
$sql="INSERT INTO data (name, email ,message)
values('$name','$email','$message')";
if($conn->query($sql)){
echo "<h2>Submit Successfully </h2>";
echo " We are reaching to you soon....";
}else{
echo "Error:" .$sql."<br>".$conn->error;
}
$conn->close();
}
}else{
die();
}
}
}else
{
die();
}
{
// echo "Name should not be empty";
die();
}
?>