-
Notifications
You must be signed in to change notification settings - Fork 0
/
contact.php
81 lines (57 loc) · 2.68 KB
/
contact.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
<?php
include "includes/db.php";
include "includes/header.php";
include "includes/nav.php";
?>
<?php
if(isset($_POST['submit'])){
$to = '[email protected]';
$email = $_POST['email'];
$subject = wordwrap($_POST['subject'], 70);
$body = wordwrap($_POST['message'], 100);
$header = "From: " . $email;
if(!empty($email && $subject && $body)){
// send email
mail($to, $subject, $body, $header);
$message_submitted = 'true';
}else{
$message_submitted = 'false';
}
}
?>
<!-- Page Content -->
<div class="container">
<section id="login">
<div class="container">
<div class="row">
<div class="col-xs-6 col-xs-offset-3">
<?php
if($message_submitted=='true'){
echo "<div class='bg bg-success message-sent'><p>Your message has been sent.</p></div>";
}else if($message_submitted=='false'){
echo "<div class='bg bg-danger message-sent'><p>Please fill out all fields before submitting your message.</p></div>";
}
?>
<div class="form-wrap">
<h1>Contact</h1>
<form role="form" action="contact.php" method="post" id="login-form" autocomplete="off">
<div class="form-group">
<label for="email" class="sr-only">Email</label>
<input type="email" name="email" id="email" class="form-control" placeholder="[email protected]">
</div>
<div class="form-group">
<label for="subject" class="sr-only">Subject</label>
<input type="text" name="subject" id="subject" class="form-control" placeholder="Subject">
</div>
<div class="form-group">
<textarea class="form-control" name="message" id="contact-message" cols="30" rows="10" placeholder="Enter Your message"></textarea>
</div>
<input type="submit" name="submit" id="btn-login" class="btn btn-custom btn-lg btn-block" value="Send Message">
</form>
</div>
</div> <!-- /.col-xs-12 -->
</div> <!-- /.row -->
</div> <!-- /.container -->
</section>
<hr>
<?php include "includes/footer.php";?>