-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchatbotform.php
More file actions
33 lines (32 loc) · 932 Bytes
/
chatbotform.php
File metadata and controls
33 lines (32 loc) · 932 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
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$problem = $_POST['problem'];
// Database connection
$conn = new mysqli('localhost','root','','vote');
if($conn->connect_error){
echo "$conn->connect_error";
die("Connection Failed : ". $conn->connect_error);
}
else {
$sql1 = "SELECT * FROM chatbot where Email='$email' and Phone='$phone'";
$result = $conn->query($sql1);
if ($result->num_rows > 0)
{
echo "Sorry, you cannot send multiple messages with same email and phone.";
}
else
{
$stmt = $conn->prepare("insert into chatbot(name, email, phone, problem) values(?, ?, ?, ?)");
$stmt->bind_param("ssis", $name, $email, $phone, $problem);
$execval = $stmt->execute();
//echo $execval;
echo '<script type="text/Javascript">
alert("Message has been sent. We will contact you back soon!");
</script>';
$stmt->close();
}
$conn->close();
}
?>