-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontactus.php
More file actions
72 lines (57 loc) · 1.9 KB
/
Copy pathcontactus.php
File metadata and controls
72 lines (57 loc) · 1.9 KB
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
<?php
include 'config.php';
$page_title = "Contact Us";
require_once('includes/dataaccess/loginDataAccess.php');
require_once("includes/header.inc.php");
?>
<!-- form for collecting data from the user-->
<form method="POST" id ="contactus">
Name:<br>
<input type="text" name="name"><br>
Eamil Address:<br>
<input type="text" name="email"><br>
Send us a message or comment:<br>
<textarea row ="20" cols ="50" id = "txtarea_comments"name="txtarea_comments"></textarea><br>
<input type="submit" name ="submitted">
</form>
<?php
$errors ='';
$contactEmail ='donovankg@yahoo.com';
//checks to see if there are any blanks in the posted txtboxes
if(empty($_POST[htmlentities('name')]) ||
empty($_POST[htmlentities('email')]) ||
empty($_POST[htmlentities('txtarea_comments')]))
{
$errors .="\n Error: all feilds are required";
}
//if the form is submitted it will collect the information and send it into an email, then redirect to login.php
If(isset($_POST['submitted'])){
if($errors !=''){
echo('please fill out all the required fields');
}else{
$name = $_POST[htmlentities('name')];
$email = $_POST[htmlentities('email')];
$txtarea_comments = $_POST[htmlentities('txtarea_comments')];
$to ='donovankg@yahoo.com';
$subject='contacted by: ' . $name .' via: donovangoldston.com/final/';
$message =($subject . ' <br> '.$txtarea_comments);
$header='from: ' . $email;
mail($to, $subject, $message);
echo'<style type="text/css">
#contactus{
visibility: hidden;
}
</style>';
if(@mail($to, $subject, $message, $header)){
echo('mail sent');
}else{
echo('mail not sent');
}
echo ", redirecting you in 4 seconds....";
header("refresh:3; url=login.php");
}
}
?>
<!-- a back link so they can back out of the page if they don't wish to enter anything -->
<br>
<a href="javascript:history.back()">return to previous page</a>