-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontact.php
More file actions
65 lines (63 loc) · 1.86 KB
/
contact.php
File metadata and controls
65 lines (63 loc) · 1.86 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
<?
$msg = '';
include 'include/functions.php';
// Validate contact form when submitted
if (isset($_POST['submit'])){
if ($_POST['name'] == '' || $_POST['email'] == '' || $_POST['message'] == ''){
$msg .= 'Inputs must not be empty';
} else {
$to = $GLOBALS['mailUser'];
$from = [
'email' => htmlspecialchars($_POST['email']),
'name' => htmlspecialchars($_POST['name']),
];
$subject = 'PropView Contact Form';
$message = htmlspecialchars($_POST['message']);
if (email($to, $from, $subject, $message)) {
$msg .= 'Message sent';
} else {
$msg .= 'Message failed to send';
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>PropView</title>
<? include 'include/head.php' ?>
<link rel="stylesheet" href="css/contact.css">
<? include 'include/header.php' ?>
<section id="right">
<div id="contact_container">
<figure>
</head>
<body>
<div id="container">
<a href="index.php"><img src="files/logo.png" id="logo" alt="PropView Logo"></a>
<figcaption>Virtual Property Supervision</figcaption>
</figure>
<form method="post" class="pure-form pure-form-stacked contact">
<?=$msg?>
<fieldset>
<div>
<label for="name-input">Name:</label>
<input type="text" id="name-input" name="name" placeholder="Your name" required>
</div>
<div>
<label for="email-input">Email address:</label>
<input type="text" id="email-input" name="email" placeholder="Email address" required>
</div>
<div>
<label for="message-input">Message:</label>
<textarea id="message-input" name="message" placeholder="Your message" required></textarea>
</div>
<button type="submit" name="submit" class="pure-button">Submit</button>
</fieldset>
</form>
</div>
</section>
<? include 'include/footer.php' ?>
</div>
</body>
</html>