-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontact.php
34 lines (29 loc) · 1007 Bytes
/
contact.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
<?php
session_start();
$conn = mysqli_connect('localhost','root','','ecommerce');
if(isset($_SESSION['username'])){
if(isset($_POST['btn-send'])){
$userName = htmlspecialchars($_POST['UName']);
$Email = htmlspecialchars($_POST['Email']);
$Subject = htmlspecialchars($_POST['Subject']);
$phonenumber = htmlspecialchars($_POST['phonenumber']);
$Mesg = htmlspecialchars($_POST['msg']);
if(empty($userName) || empty($Email) || empty($phonenumber) || empty($Mesg)|| empty($Subject) ){
header("location:contacter.php?error");
}
else{
$sql = "INSERT INTO `contact_us` (`User_name`, `email`, `phone`, `message`, `subject`) VALUES ('$userName','$Email', '$phonenumber',' $Mesg','$Subject')";
$res=mysqli_query($conn, $sql);
if($res){
header("location:contacter.php?success");
}
else {
echo'<h1>Something not working</h1>';
}
}
}
}
else{
header("location:contacter.php?signup");
}
?>