-
Notifications
You must be signed in to change notification settings - Fork 0
/
contact_get.php
54 lines (45 loc) · 1.7 KB
/
contact_get.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
53
54
<?php
if (isset($_POST['contact']))
{
require_once('DBCONFIG/dbconfig.php');
if (class_exists('DATABASE_CONNECT'))
{
$obj_conn = new DATABASE_CONNECT;
$host = $obj_conn->connect[0];
$user = $obj_conn->connect[1];
$pass = $obj_conn->connect[2];
$db = $obj_conn->connect[3];
$conn = new mysqli($host,$user,$pass,$db);
if ($conn->connect_error)
{
die ("Cannot connect " .$conn->connect_error);
}
else
{
$name = $_POST['Name'];
$phone = $_POST['Phone'];
$email = $_POST['Email'];
$services = $_POST['Services'];
$message = $_POST['Message'];
$sql = "insert into contactform
(Name, Phone, Email, Service, Message)
values('$name', '$phone', '$email', '$services', '$message')";
$result = $conn->query($sql);
if ($result == true)
{
echo '<script type="text/javascript">alert("Your message has been submitted!.");
</script>';
echo ("<script>location.href='index.php'</script>");
exit;
}
else
{
echo '<script type="text/javascript">alert("Your message is not submitted!");
</script>';
echo ("<script>location.href='index.php'</script>");
exit;
}
}
}
}
?>