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> <ul>
<li class="nav-item"><a class="nav-link" href="dallas.html">Dallas <li class="nav-item"><a class="nav-link" href="dallas.html">Dallas
Regionals</a></li> 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> </ul>
</li> </li>
<li class="nav-item submenu"><a class="nav-link" href="#">Austin Regionals</a> <li class="nav-item submenu"><a class="nav-link" href="#">Austin Regionals</a>
@@ -128,14 +129,17 @@
<div class="page-contact-us"> <div class="page-contact-us">
<div class="container"> <div class="container">
<div class="row align-items-center"> <div class="row align-items-center">
<div class="col-lg-6"> <div class="col-lg-12">
<!-- Contact Information Start --> <!-- Contact Information Start -->
<div class="contact-information"> <div class="contact-information">
<!-- Contact Information Title Start --> <!-- Contact Information Title Start -->
<div class="section-title"> <div class="section-title">
<h3 class="wow fadeInUp">Reach Out</h3> <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> <h2 class="text-anime-style-2" data-cursor="-opaque">Reach Out to Our <span>Student-Led
<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> 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> </div>
<!-- Contact Information Title End --> <!-- Contact Information Title End -->
@@ -175,90 +179,74 @@
</div> </div>
<!-- Contact Info Item End --> <!-- 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> </div>
<!-- Contact Information List End --> <!-- Contact Information List End -->
</div> </div>
<!-- Contact Information End --> <!-- Contact Information End -->
</div> </div>
<div class="col-lg-6"> <script>
<!-- Contact Form Start --> async function submitForm() {
<div class="contact-us-form wow fadeInUp" data-wow-delay="0.25s"> const fname = document.getElementById('fname').value.trim();
<form id="contactForm" action="#" method="POST" data-toggle="validator" class="wow fadeInUp" data-wow-delay="0.5s"> const lname = document.getElementById('lname').value.trim();
<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> const email = document.getElementById('email').value.trim();
<div class="row"> const phone = document.getElementById('phone').value.trim();
<div class="form-group col-md-6 mb-4"> const message = document.getElementById('msg').value.trim();
<input type="text" name="name" class="form-control" id="fname" placeholder="First Name" required> const btn = document.getElementById('submitBtn');
<div class="help-block with-errors"></div> const errorEl = document.getElementById('errorMsg');
</div>
<div class="form-group col-md-6 mb-4"> // Basic validation
<input type="text" name="name" class="form-control" id="lname" placeholder="Last Name" required> if (!fname || !lname || !email || !phone || !message) {
<div class="help-block with-errors"></div> errorEl.textContent = 'Please fill in all fields.';
</div> errorEl.style.display = 'block';
return;
}
<div class="form-group col-md-6 mb-4"> // Button loading state
<input type="email" name="email" class="form-control" id="email" placeholder="Email Address" required> btn.textContent = 'Sending...';
<div class="help-block with-errors"></div> btn.disabled = true;
</div> errorEl.style.display = 'none';
<div class="form-group col-md-6 mb-4"> try {
<input type="text" name="phone" class="form-control" id="phone" placeholder="Phone No" required> const response = await fetch('https://api.web3forms.com/submit', {
<div class="help-block with-errors"></div> method: 'POST',
</div> 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"> const data = await response.json();
<textarea name="msg" class="form-control" id="msg" rows="5" placeholder="Message" required></textarea>
<div class="help-block with-errors"></div>
</div>
<div class="col-lg-12"> if (data.success) {
<div class="contact-form-btn"> // Hide form, show success
<button type="submit" class="btn-default">submit message</button> document.getElementById('contactFormFields').style.display = 'none';
<div id="msgSubmit" class="h3 hidden"></div> document.getElementById('successMsg').style.display = 'block';
</div> } else {
</div> throw new Error(data.message || 'Submission failed');
</div> }
</form>
</div> } catch (err) {
<!-- Contact Form End --> btn.textContent = 'submit message';
</div> 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>
</div> </div>
</div>
<!-- Page Contact Us End --> <!-- 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 Start -->
<footer class="main-footer"> <footer class="main-footer">
@@ -302,7 +290,8 @@
<ul> <ul>
<li><a href="https://www.instagram.com/texasscholasticcricketboard/"><i <li><a href="https://www.instagram.com/texasscholasticcricketboard/"><i
class="fa-brands fa-instagram"></i></a></li> 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> </ul>
</div> </div>
@@ -438,4 +427,4 @@
<script src="js/function.js"></script> <script src="js/function.js"></script>
</body> </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;
}
}
?>