AI and contact fixed

This commit is contained in:
Keshav Anand
2026-03-14 15:07:36 -05:00
parent 7206cec8d2
commit d5fe9ad5c4
2 changed files with 63 additions and 148 deletions

View File

@@ -71,7 +71,8 @@
<ul>
<li class="nav-item"><a class="nav-link" href="dallas.html">Dallas
Regionals</a></li>
<li class="nav-item"><a class="nav-link" href="dallas-teams.html">Dallas Teams</a></li>
<li class="nav-item"><a class="nav-link" href="dallas-teams.html">Dallas
Teams</a></li>
</ul>
</li>
<li class="nav-item submenu"><a class="nav-link" href="#">Austin Regionals</a>
@@ -128,14 +129,17 @@
<div class="page-contact-us">
<div class="container">
<div class="row align-items-center">
<div class="col-lg-6">
<div class="col-lg-12">
<!-- Contact Information Start -->
<div class="contact-information">
<!-- Contact Information Title Start -->
<div class="section-title">
<h3 class="wow fadeInUp">Reach Out</h3>
<h2 class="text-anime-style-2" data-cursor="-opaque">Reach Out to Our <span>Student-Led Board</span></h2>
<p class="wow fadeInUp" data-wow-delay="0.25s">Whether you're a student, parent, or school administrator, we're here to help. Reach out to our student-led board with any questions about joining a team, starting a new program, or getting involved with TSCB.</p>
<h2 class="text-anime-style-2" data-cursor="-opaque">Reach Out to Our <span>Student-Led
Board</span></h2>
<p class="wow fadeInUp" data-wow-delay="0.25s">Whether you're a student, parent, or school
administrator, we're here to help. Reach out to our student-led board with any questions
about joining a team, starting a new program, or getting involved with TSCB.</p>
</div>
<!-- Contact Information Title End -->
@@ -175,90 +179,74 @@
</div>
<!-- Contact Info Item End -->
<!-- Contact Info Item Start -->
<div class="contact-info-item wow fadeInUp" data-wow-delay="0.75s">
<!-- Icon Box Start -->
<div class="icon-box">
<img src="images/icon-location.svg" alt="">
</div>
<!-- Icon Box End -->
<!-- Contact Info Content Start -->
<div class="contact-info-content">
<p>Visit our location</p>
<h3>Texas, USA</h3>
</div>
<!-- Contact Info Content End -->
</div>
<!-- Contact Info Item End -->
</div>
<!-- Contact Information List End -->
</div>
<!-- Contact Information End -->
</div>
<div class="col-lg-6">
<!-- Contact Form Start -->
<div class="contact-us-form wow fadeInUp" data-wow-delay="0.25s">
<form id="contactForm" action="#" method="POST" data-toggle="validator" class="wow fadeInUp" data-wow-delay="0.5s">
<p class="mb-4">We'd love to hear from you! Fill out the form below and our student-led board will get back to you as soon as possible. Whether you have questions about our programs, want to start a team at your school, or just want to say hello, we're here to help!</p>
<div class="row">
<div class="form-group col-md-6 mb-4">
<input type="text" name="name" class="form-control" id="fname" placeholder="First Name" required>
<div class="help-block with-errors"></div>
</div>
<script>
async function submitForm() {
const fname = document.getElementById('fname').value.trim();
const lname = document.getElementById('lname').value.trim();
const email = document.getElementById('email').value.trim();
const phone = document.getElementById('phone').value.trim();
const message = document.getElementById('msg').value.trim();
const btn = document.getElementById('submitBtn');
const errorEl = document.getElementById('errorMsg');
<div class="form-group col-md-6 mb-4">
<input type="text" name="name" class="form-control" id="lname" placeholder="Last Name" required>
<div class="help-block with-errors"></div>
</div>
// Basic validation
if (!fname || !lname || !email || !phone || !message) {
errorEl.textContent = 'Please fill in all fields.';
errorEl.style.display = 'block';
return;
}
<div class="form-group col-md-6 mb-4">
<input type="email" name="email" class="form-control" id="email" placeholder="Email Address" required>
<div class="help-block with-errors"></div>
</div>
// Button loading state
btn.textContent = 'Sending...';
btn.disabled = true;
errorEl.style.display = 'none';
<div class="form-group col-md-6 mb-4">
<input type="text" name="phone" class="form-control" id="phone" placeholder="Phone No" required>
<div class="help-block with-errors"></div>
</div>
try {
const response = await fetch('https://api.web3forms.com/submit', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
access_key: '6c4376f3-1658-48cc-bec1-5bbf3df39b1a',
subject: 'New Contact Inquiry - TSCB Website',
name: `${fname} ${lname}`,
email: email,
phone: phone,
message: message,
})
});
<div class="form-group col-md-12 mb-4">
<textarea name="msg" class="form-control" id="msg" rows="5" placeholder="Message" required></textarea>
<div class="help-block with-errors"></div>
</div>
const data = await response.json();
<div class="col-lg-12">
<div class="contact-form-btn">
<button type="submit" class="btn-default">submit message</button>
<div id="msgSubmit" class="h3 hidden"></div>
</div>
</div>
</div>
</form>
</div>
<!-- Contact Form End -->
</div>
if (data.success) {
// Hide form, show success
document.getElementById('contactFormFields').style.display = 'none';
document.getElementById('successMsg').style.display = 'block';
} else {
throw new Error(data.message || 'Submission failed');
}
} catch (err) {
btn.textContent = 'submit message';
btn.disabled = false;
errorEl.textContent = 'Something went wrong. Please try again or email us directly.';
errorEl.style.display = 'block';
}
}
</script>
<!-- Contact Form End -->
</div>
</div>
</div>
</div>
<!-- Page Contact Us End -->
<!-- Google Map Start -->
<div class="google-map">
<div class="container-fluid">
<div class="row no-gutter">
<div class="col-lg-12">
<!-- Google Map Iframe Start -->
<div class="google-map-iframe">
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d115193.90934498374!2d-96.99988818873084!3d32.77666484999998!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x864e97c65f33d001%3A0xc70760b2c8f7e745!2sDallas%2C%20TX%2C%20USA!5e0!3m2!1sen!2sin!4v1703158537552!5m2!1sen!2sin" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
</div>
<!-- Google Map Iframe End -->
</div>
</div>
</div>
</div>
<!-- Google Map End -->
<!-- Footer Start -->
<footer class="main-footer">
@@ -302,7 +290,8 @@
<ul>
<li><a href="https://www.instagram.com/texasscholasticcricketboard/"><i
class="fa-brands fa-instagram"></i></a></li>
<li><a href="https://www.youtube.com/channel/UCdFfqkVWDJyFlFEEKfq27wg"><i class="fa-brands fa-youtube"></i></a></li>
<li><a href="https://www.youtube.com/channel/UCdFfqkVWDJyFlFEEKfq27wg"><i
class="fa-brands fa-youtube"></i></a></li>
</ul>
</div>
@@ -438,4 +427,4 @@
<script src="js/function.js"></script>
</body>
</html>
</html>

View File

@@ -1,74 +0,0 @@
<?php
$errorMSG = "";
// FIRSTNAME
if (empty($_POST["fname"])) {
$errorMSG = "Full Name is required. ";
} else {
$fname = $_POST["fname"];
}
// LASTNAME
if (empty($_POST["lname"])) {
$errorMSG = "Full Name is required. ";
} else {
$lname = $_POST["lname"];
}
// EMAIL
if (empty($_POST["email"])) {
$errorMSG .= "Email is required. ";
} else {
$email = $_POST["email"];
}
// PHONE
if (empty($_POST["phone"])) {
$errorMSG .= "Phone is required. ";
} else {
$phone = $_POST["phone"];
}
// MESSAGE
if (empty($_POST["message"])) {
$errorMSG .= "Message is required. ";
} else {
$message = $_POST["message"];
}
$subject = 'Contact Inquiry from Website';
//$EmailTo = "info@yourdomain.com"; // Replace with your email.
$EmailTo = "texasscholasticcricketboard@gmail.com";
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $fname." ".$lname;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $email;
$Body .= "\n";
$Body .= "Phone: ";
$Body .= $phone;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $message;
$Body .= "\n";
// send email
$success = @mail($EmailTo, $subject, $Body, "From:".$email);
// redirect to success page
if ($success && $errorMSG == ""){
echo "success";
}else{
if($errorMSG == ""){
echo "Something went wrong :(";
} else {
echo $errorMSG;
}
}
?>