-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcontact.php
More file actions
106 lines (87 loc) · 2.94 KB
/
contact.php
File metadata and controls
106 lines (87 loc) · 2.94 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = $_POST["name"];
$email = $_POST["email"];
$message = $_POST["message"];
// Customize these settings for your email configuration
$to = "hthcoin@gmail.com"; // Replace with your email address
$subject = "Contact Form Submission from $name";
$headers = "From: $email";
$messageBody = "Name: $name\nEmail: $email\nMessage:\n$message";
// Send the email
$sent = mail($to, $subject, $messageBody, $headers);
if ($sent) {
// Email sent successfully
echo '<div class="success">Your message has been sent successfully.</div>';
} else {
// Email not sent
echo '<div class="error">Sorry, there was an issue sending your message. Please try again later.</div>';
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Contact Us</title>
<link rel="stylesheet" href="css/style.css">
<style>
body {
font-family: Arial, sans-serif;
background-color: #333;
margin: 0;
padding: 0;
text-align: center;
}
h1 {
color: #debf12;
}
</style>
</head>
<body style="background-color: #333">
<header>
<h1>Contact Us</h1>
<p style="color: #debf12">If you have any questions or would like to get involved, please fill out the form below:</p>
</header>
<?php
// Include the navigation bar
include('navbar.php');
?>
</br>
</br>
<main>
<section id="contact-form">
<form action="contact.php" method="post">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<label for="message">Message:</label>
<textarea id="message" name="message" rows="4" required></textarea>
<a id="send-email" class="mailto-link">
<button type="button">Send</button>
</a>
</form>
</section>
</main>
</br>
<?php
// Include the footer
include('footer.php');
?>
<script>
document.getElementById("send-email").addEventListener("click", function () {
var name = encodeURIComponent(document.getElementById("name").value);
var email = encodeURIComponent(document.getElementById("email").value);
var message = encodeURIComponent(document.getElementById("message").value);
var mailtoLink = "mailto:hthcoin@gmail.com" +
"?subject=Contact Form Submission" +
"&body=Name: " + name +
"%0AEmail: " + email +
"%0AMessage:%0A" + message;
this.href = mailtoLink;
});
</script>
</body>
</html>