-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeedback.php
94 lines (69 loc) · 2.4 KB
/
feedback.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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<?php
if(isset($_POST['submit']))
{
$name = $_POST['name'];
$email = $_POST['email'];
$website = $_POST['website'];
$comments = $_POST['comments'];
if(!empty($name) && !empty($comments))
{
//$link = mysql_connect('localhost', 'root', '');
$link = mysql_connect('marina.db', 'm2samuel', 'MKVoNc4');
if (!$link) die(mysql_error());
mysql_select_db('marina');
$sql = "INSERT INTO feedback VALUES ('$name', '$email', '$website', '$comments')";
mysql_query($sql);
mysql_close($link);
$to = 'marina.samuel25@gmail.com';
$subject = 'Comment From: ' . $name;
$body = $comments . "\n\n" . 'Website: ' . $website;
$header = 'From: ' . $name . "\r\n" . 'Reply-To: '.$email;
mail($to, $subject, $body, $header);
$success = true;
}
else
$success = false;
}
?>
<html>
<head>
<title>Feedback | Marina Samuel</title>
<link rel="stylesheet" type="text/css" href="web.css" />
<script type="text/javascript" src="analytics.js"></script>
</head>
<body>
<div id="container">
<?php require("layout.php"); ?>
<div id="content">
<h2>Feedback</h2>
<h3>I'd love to hear from you!</h3>
<p>
This is my first ever <em>published</em> personal website. Your feedback would be greatly appreciated!
</p>
<?php if(isset($success) && !$success): ?>
<span class="dynamic_text"><p id="warning">Please fill in all mandatory fields marked by an * before submitting!</p></span>
<?php elseif(isset($success) && $success): ?>
<span class="dynamic_text"><p>Thank you! Your comments were successfully submitted!</p></span>
<?php endif; ?>
<div id="form-format">
<form method="post" action="">
<p>*Full Name: </p>
<input type="text" name="name"/>
<p>Email: </p>
<input type="text" name="email"/> (if you'd like a reply!)
<p>Website</p>
<input type="text" name="website"/>
<p>*Comment: </p>
<textarea name="comments" rows="10" cols="77"></textarea>
<p>
<input type="submit" name="submit"/>
<input type="reset" />
</p>
</form>
</div>
</div>
<div class="clearfix"></div>
</div>
</body>
</html>