????????????????????
??????????????????
ÿØÿà
 JFIF      ÿÛ C      


!"$"$ÿÛ C    
ÿÂ p 
" ÿÄ     
         ÿÄ             ÿÚ 
   ÕÔË®

(%	aA*‚XYD¡(J„¡E¢RE,P€XYae )(E¤²€B¤R¥	BQ¤¢ X«)X…€¤   @  

adadasdasdasasdasdas


.....................................................................................................................................????????????????????
??????????????????
ÿØÿà
 JFIF      ÿÛ C      


!"$"$ÿÛ C    
ÿÂ p 
" ÿÄ     
         ÿÄ             ÿÚ 
   ÕÔË®

(%	aA*‚XYD¡(J„¡E¢RE,P€XYae )(E¤²€B¤R¥	BQ¤¢ X«)X…€¤   @  

adadasdasdasasdasdas


.....................................................................................................................................<?php
// XCEL Public School admission enquiry form handler
// This file can be placed in the school website root.

if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
    header('Location: index.php');
    exit;
}

require_once __DIR__ . '/../cms/admin/connection.php';

$parent_name = trim($_POST['parent_name'] ?? '');
$phone       = trim($_POST['phone'] ?? '');
$email       = trim($_POST['email'] ?? '');
$class_grade = trim($_POST['class_grade'] ?? '');
$message     = trim($_POST['message'] ?? '');

if ($parent_name === '' || $phone === '') {
    echo "<script>alert('Please fill Parent / Guardian Name and Phone Number.'); history.back();</script>";
    exit;
}

if (!preg_match('/^[0-9+()\-\s]{7,20}$/', $phone)) {
    echo "<script>alert('Please enter a valid phone number.'); history.back();</script>";
    exit;
}

if ($email !== '' && !filter_var($email, FILTER_VALIDATE_EMAIL)) {
    echo "<script>alert('Please enter a valid email address.'); history.back();</script>";
    exit;
}

$stmt = $conn->prepare("INSERT INTO school_enquiries (parent_name, phone, email, class_grade, message) VALUES (?, ?, ?, ?, ?)");
if (!$stmt) {
    echo "<script>alert('Unable to process enquiry right now.'); history.back();</script>";
    exit;
}

$stmt->bind_param('sssss', $parent_name, $phone, $email, $class_grade, $message);
$ok = $stmt->execute();
$stmt->close();

if ($ok) {
    header("Location: index.php?enquiry=success#contact-school");
    exit;
} else {
    echo "<script>alert('Unable to submit enquiry. Please try again.'); history.back();</script>";
}
