-
Notifications
You must be signed in to change notification settings - Fork 0
/
contact.php
154 lines (133 loc) · 4.71 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?php include 'inc/header.php';?>
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$name = $fm->validation($_POST['name']);
$name = mysqli_real_escape_string($db->link, $name);
$email = $fm->validation($_POST['email']);
$email = mysqli_real_escape_string($db->link, $email);
$subject = $fm->validation($_POST['subject']);
$subject = mysqli_real_escape_string($db->link, $subject);
$body = $fm->validation($_POST['body']);
$body = mysqli_real_escape_string($db->link, $body);
// $error = " ";
// if(empty($name)){
// $error = "Name must not be empty! ";
// }elseif(empty($email)){
// $error = "Email must not be empty! ";
// }elseif(empty($body)){
// $error = "Message must not be empty! ";
// }elseif(!filter_var($email, FILTER_VALIDATE_EMAIL)){
// $error = "Invalid Email!";
// } else{
// $query = "INSERT INTO tbl_contact(name, email, subject, body) VALUES('$name', '$email', '$subject' ,'$body' ) ";
// $insert_form = $db->insert($query);
// if ($insert_form) {
// $msg= "<span class = 'success'> Message sent successfully! </span>";
// } else {
// $msg= "<span class = 'error'> Message not sent! </span>";
// }
// }
$error_name = "";
$error_email = "";
$error_message = "";
$error_invalid = "";
if(empty($name)){
$error_name = " *Name must not be empty!";
}
elseif(empty($email)){
$error_email = " *Email must not be empty!";
}
elseif(empty($body)){
$error_message = " *Message must not be empty!";
}
elseif(!filter_var($email, FILTER_VALIDATE_EMAIL)){
$error_invalid = " *Invalid Email!";
}
else{
$query = "INSERT INTO tbl_contact(name, email, subject, body) VALUES('$name', '$email', '$subject' ,'$body' ) ";
$insert_form = $db->insert($query);
if ($insert_form) {
$msg= "<span class = 'success'> Message sent successfully! </span>";
} else {
$msg= "<span class = 'error'> Message not sent! </span>";
}
}
}
?>
<div class="main">
<div class="content">
<div class="support">
<div class="support_desc">
<h3>Live Support</h3>
<p><span>24 hours | 7 days a week | 365 days a year Live Technical Support</span></p>
<p> Please let us know about your thoughts. Feel free to knock us.</p>
</div>
<img src="web/images/contact.png" alt="" />
<div class="clear"></div>
</div>
<div class="section group">
<div class="col span_2_of_3">
<div class="contact-form">
<h2>Contact Us</h2>
<?php
if(isset($error)){ echo "<span class='error'> $error </span> ";
}
if(isset($msg)){ echo "<span class='success'> $msg </span> ";
}
?>
<form action=" " method="post">
<div>
<span><label>NAME</label>
<?php
if(isset($error_name)){ echo "<span class='error'> $error_name </span> ";
}
?>
</span>
<span><input type="text" name="name" class="form_input"></span>
</div>
<div>
<span><label>E-MAIL</label>
<?php
if(isset($error_email)){ echo "<span class='error'> $error_email </span> ";
}
elseif(isset($error_invalid)){ echo "<span class='error'> $error_invalid </span> ";
}
?>
</span>
<span><input type="email" name="email" class="form_input"></span>
</div>
<div>
<span><label>SUBJECT</label></span>
<span><input type="text" name="subject"class="form_input"></span>
</div>
<div>
<span><label>MESSAGE</label>
<?php
if(isset($error_message)){ echo "<span class='error'> $error_message </span> ";
}
?>
</span>
<span><textarea name="body" class="form_input"> </textarea></span>
</div>
<div class="center">
<span><input type="submit" value="SEND" class="btn btn_send"></span>
</div>
</form>
</div>
</div>
<div class="col span_1_of_3">
<div class="company_address">
<h2>Company Information :</h2>
<p>500 Lorem Ipsum Dolor Sit,</p>
<p>22-56-2-9 Sit Amet, Lorem,</p>
<p>USA</p>
<p>Phone:(00) 222 666 444</p>
<p>Fax: (000) 000 00 00 0</p>
<p>Email: <span>info@mycompany.com</span></p>
<p>Follow on: <span>Facebook</span>, <span>Twitter</span></p>
</div>
</div>
</div>
</div>
</div>
<?php include 'inc/footer.php';?>