You are on page 1of 1

<?

php
if (isset($_POST
['msg'])) {
$mname=$_POST['mname'];
$memail=$_POST['memail'];
$phone=$_POST['phone'];
$web=$_POST['web'];
$message=$_POST['message'];
if($mname==''){
echo "<script>alert('Please enter your name!'); window.l
ocation.href='contact.php';</script>";
exit();
}
if($memail==''){
echo "<script>alert('Please enter your email add
ress!'); window.location.href='contact.php';</script>";
exit();
}
if($phone==''){
echo "<script>alert('Please enter your phone num
ber!'); window.location.href='contact.php';</script>";
exit();
}
$query = mysqli_query($conn, "INSERT INTO messag
e (usr_nme,usr_mail,usr_4n,msg_box,website,date)VALUES ('$mname','$memail','$pho
ne','$message','$web',NOW())") or die(mysql_error());
if($query){
echo "<script>alert('$mname || Your message has
been send!'); window.location='index.php'</script>";
}
}
?>

You might also like