-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
38 lines (32 loc) · 1.1 KB
/
index.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
<?php
if (!empty($_POST)) {
require_once 'ContactEmail.php';
// The email address you want messages sent to
$from = isset($_POST['email']) ? $_POST['email'] : null;
$name = isset($_POST['name']) ? $_POST['name'] : null;
$message = isset($_POST['message']) ? $_POST['message'] : null;
$contactEmail = new App\ContactEmail($from, $message, $name);
$emailSent = $contactEmail->send();
}
?>
<?php if (isset($emailSent) && $emailSent) : ?>
<div>Email successfully sent!</div>
<?php endif; ?>
<div class="contact">
<!-- contact form here -->
<form action="index.php" method="post">
<div>
<label for="name">Your Name</label>
<input type="text" id="name" name="name" required>
</div>
<div>
<label for="email">Your Email Address</label>
<input type="email" id="email" name="email" required>
</div>
<div>
<label for="message">Message</label>
<textarea id="message" name="message" required></textarea>
</div>
<button type="submit">Send</button>
</form>
</div>