add contact - going to test
This commit is contained in:
parent
b3f940074f
commit
9faf973d03
96
index.html
96
index.html
@ -100,6 +100,102 @@
|
|||||||
<img src="assets/pics/helium/img1.webp" alt="Image 1" >
|
<img src="assets/pics/helium/img1.webp" alt="Image 1" >
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- <div class="container">
|
||||||
|
<div class="columns is-justify-content-center ">
|
||||||
|
<div class="column is-6-tablet is-5-desktop is-4-widescreen is-3-fullh">
|
||||||
|
<form method="POST" action="https://herotofu.com/start" class="box p-5">
|
||||||
|
<label class="is-block mb-4">
|
||||||
|
<span class="is-block mb-2">Your name</span>
|
||||||
|
<input
|
||||||
|
name="name"
|
||||||
|
type="text"
|
||||||
|
class="input"
|
||||||
|
placeholder="Joe Bloggs"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label class="is-block mb-4">
|
||||||
|
<span class="is-block mb-2">Email address</span>
|
||||||
|
<input
|
||||||
|
required
|
||||||
|
name="email"
|
||||||
|
type="email"
|
||||||
|
class="input"
|
||||||
|
placeholder="joe.bloggs@example.com"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label class="is-block mb-4">
|
||||||
|
<span class="is-block mb-2">Message</span>
|
||||||
|
<textarea
|
||||||
|
name="message"
|
||||||
|
class="textarea"
|
||||||
|
rows="3"
|
||||||
|
placeholder="Tell us what you're thinking about..."
|
||||||
|
></textarea>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div class="mb-4">
|
||||||
|
<button type="submit" class="button is-link px-4">Contact Us</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div class="is-size-7 has-text-right">
|
||||||
|
by
|
||||||
|
<a
|
||||||
|
href="https://herotofu.com/start"
|
||||||
|
class="has-text-dark"
|
||||||
|
target="_blank"
|
||||||
|
>HeroTofu</a
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div> -->
|
||||||
|
<section class="section">
|
||||||
|
<div class="container">
|
||||||
|
<h1 class="title">Contact Us</h1>
|
||||||
|
<form action="sendEmail.php" method="post">
|
||||||
|
<div class="field">
|
||||||
|
<label class="label">Name</label>
|
||||||
|
<div class="control">
|
||||||
|
<input class="input" type="text" name="name" placeholder="Your Name" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label class="label">Email</label>
|
||||||
|
<div class="control">
|
||||||
|
<input class="input" type="email" name="email" placeholder="Your Email" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label class="label">Phone</label>
|
||||||
|
<div class="control">
|
||||||
|
<input class="input" type="tel" name="phone" placeholder="Your Phone Number" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label class="label">Subject</label>
|
||||||
|
<div class="control">
|
||||||
|
<input class="input" type="text" name="subject" placeholder="Subject" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label class="label">Message</label>
|
||||||
|
<div class="control">
|
||||||
|
<textarea class="textarea" name="message" placeholder="Your Message" required></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<div class="control">
|
||||||
|
<button class="button is-primary" type="submit">Send Message</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
<footer class="footer has-background-primary-light">
|
<footer class="footer has-background-primary-light">
|
||||||
<div class="content has-text-centered">
|
<div class="content has-text-centered">
|
||||||
<h7>Copyright © <span id="year"></span> Beach Party Balloons</h7>
|
<h7>Copyright © <span id="year"></span> Beach Party Balloons</h7>
|
||||||
|
|||||||
37
sendEmail.php
Normal file
37
sendEmail.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
// Validate and sanitize inputs
|
||||||
|
$name = htmlspecialchars(trim($_POST['name']));
|
||||||
|
$email = filter_var(trim($_POST['email']), FILTER_SANITIZE_EMAIL);
|
||||||
|
$subject = htmlspecialchars(trim($_POST['subject']));
|
||||||
|
$message = htmlspecialchars(trim($_POST['message']));
|
||||||
|
|
||||||
|
// Check if the email is valid
|
||||||
|
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
echo "Invalid email address.";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prepare email
|
||||||
|
$to = "info@beachpartyballons.com"; // Replace with your business email
|
||||||
|
$headers = "From: $name <$email>\r\n";
|
||||||
|
$headers .= "Reply-To: $email\r\n";
|
||||||
|
$headers .= "Content-Type: text/plain; charset=UTF-8\r\n";
|
||||||
|
|
||||||
|
$email_body = "You have received a new message from your website contact form.\n\n";
|
||||||
|
$email_body .= "Name: $name\n";
|
||||||
|
$email_body .= "Email: $email\n";
|
||||||
|
$email_body .= "Phone: $phone\n";
|
||||||
|
$email_body .= "Subject: $subject\n\n";
|
||||||
|
$email_body .= "Message:\n$message\n";
|
||||||
|
|
||||||
|
// Send email
|
||||||
|
if (mail($to, $subject, $email_body, $headers)) {
|
||||||
|
echo "Message sent successfully!";
|
||||||
|
} else {
|
||||||
|
echo "Failed to send message. Please try again later.";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo "Invalid request.";
|
||||||
|
}
|
||||||
|
?>
|
||||||
Loading…
x
Reference in New Issue
Block a user