-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontactus.php
34 lines (27 loc) · 1.04 KB
/
contactus.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
<?php
include ("dbconnect.php");
$name = $_POST["name"];
$email = $_POST["email"];
$website = $_POST["web"];
$message = $_POST["message"];
session_start();
$username = $_SESSION["uname"];
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
$sql = "insert into contactus (name,email,web,message) values ('$name','$email','$website','$message')";
if ($conn->query($sql) === TRUE) {
if ($username == NULL) {
echo "<script type='text/javascript'>alert('Submitted successfully!'); "
. "window.location.href='http://localhost/FastFood/contact.html';</script>";
} else {
echo "<script type='text/javascript'>alert('Submitted successfully!'); "
. "window.location.href='http://localhost/FastFood/logusercontact.php';</script>";
}
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
} else {
echo "<script type='text/javascript'>alert('Email is invalid'); "
. "window.location.href='http://localhost/FastFood/contact.html';</script>";
}
?>