-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontact.php
More file actions
49 lines (42 loc) · 1.89 KB
/
contact.php
File metadata and controls
49 lines (42 loc) · 1.89 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
<?php
include 'includes/config.php';
include 'includes/header.php';
$statusMsg = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = htmlspecialchars(trim($_POST['name']));
$email = htmlspecialchars(trim($_POST['email']));
$message = htmlspecialchars(trim($_POST['message']));
if (!empty($name) && !empty($email) && !empty($message)) {
try {
$stmt = $pdo->prepare("INSERT INTO messages (name, email, message) VALUES (?, ?, ?)");
if ($stmt->execute([$name, $email, $message])) {
$statusMsg = "<p class='status-success'>Message sent successfully! We will get back to you soon.</p>";
}
} catch (PDOException $e) {
$statusMsg = "<p class='status-error'>Oops! Something went wrong. Please try again later.</p>";
}
}
}
?>
<section class="contact-section">
<div class="contact-container">
<div class="contact-info">
<h2>Get in Touch</h2>
<p>We’d love to hear from you! For questions, feedback, or business inquiries, feel free to contact us.</p>
<p><strong>Email:</strong> support@kapekuripot.com</p>
<p><strong>Phone:</strong> +63 912 345 6789</p>
<p><strong>Address:</strong> Pureza, Sta. Mesa, Manila</p>
</div>
<div class="contact-form-box">
<h3>Send Us a Message</h3>
<?php echo $statusMsg; ?>
<form action="contact.php" method="POST">
<input type="text" name="name" placeholder="Full Name" required>
<input type="email" name="email" placeholder="Email Address" required>
<textarea name="message" placeholder="Your Message" rows="5" required></textarea>
<button type="submit" class="btn-primary">Send Message</button>
</form>
</div>
</div>
</section>
<?php include 'includes/footer.php'; ?>