All fields are required.';
} elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$alertMessage = '
Invalid email format.
';
} elseif (!ctype_digit($mobile) || strlen($mobile) < 10 || strlen($mobile) > 15) {
$alertMessage = 'Invalid mobile number.
';
} elseif (!ctype_digit($aadhar) || strlen($aadhar) != 12) {
$alertMessage = 'Invalid Aadhar number. Must be 12 digits.
';
} elseif (!ctype_digit($zip_code)) {
$alertMessage = 'Zip Code should contain only digits.
';
} else {
// Insert into database
$query = "INSERT INTO puja_booking
(name, mobile, email, gender, age, aadhar, puja_type, booking_date, gotra, country, state, city, zip_code, address, purpose)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
if ($stmt = $con->prepare($query)) {
///$stmt->bind_param("sisssisssssssss", $name, $mobile, $email, $gender, $age, $aadhar, $puja_type, $booking_date, $gotra, $country, $state, $city, $zip_code, $address, $purpose);
$stmt->bind_param("sssssssssssssss", $name, $mobile, $email, $gender, $age, $aadhar, $puja_type, $booking_date, $gotra, $country, $state, $city, $zip_code, $address, $purpose);
if ($stmt->execute()) {
$last_id = $stmt->insert_id;
$_SESSION['booking_id'] = $last_id;
header("Location: mail.php");
exit();
} else {
$alertMessage = 'Error processing your booking: ' . $stmt->error . '
';
}
/*if ($stmt->execute()) {
$last_id = $stmt->insert_id; // get last inserted booking ID
$_SESSION['booking_id'] = $last_id;
header("Location: mail.php");
exit();
}
else {
$alertMessage = 'Error processing your booking.
';
}*/
$stmt->close();
} else {
$alertMessage = 'Database error. Please try again later.
';
}
}
}
?>
Online Puja Reservation
Online Puja Reservation
- Home
- Online Puja Reservation
Join us in making a difference — Become a donor today!
query($sql);
if ($result->num_rows > 0) {
$row = $result->fetch_assoc();
?>
No content available currently.";
}
?>