-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontact.php
More file actions
42 lines (36 loc) · 964 Bytes
/
contact.php
File metadata and controls
42 lines (36 loc) · 964 Bytes
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
<?php
$yourname = check_input($_POST['name'], "Enter your name");
$email = check_input($_POST['email']);
$comments = check_input($_POST['message'], "Write your comments");
$recipient = "sales@webtisans.com";
$subject = "A new potential client has filled in the form of the website.";
$message = "Hi, a new person has filled the following information in the website: Name:"+$yourname+", Email: "+$email+", Message: "+$message;
?>
<?php
function check_input($data, $problem='')
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
if ($problem && strlen($data) == 0)
{
show_error($problem);
}else{
mail($recipient, $subject, $message);
header('Location:thank-you.html');
}
return $data;
}
function show_error($myError)
{
?>
<html>
<body>
<b>Please correct the following error:</b><br />
<?php echo $myError; ?>
</body>
</html>
<?php
exit();
}
?>