This commit is contained in:
Flatlogic Bot 2025-12-12 09:56:45 +00:00
parent b4ffcec973
commit e825aa97f2

View File

@ -1,4 +1,9 @@
<?php
// Debugging: Dump POST data
echo '<pre>';
var_dump($_POST);
echo '</pre>';
require_once 'db/config.php';
// Fetch all contracts for the dropdown
@ -30,6 +35,9 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
} elseif (!filter_var($email, FILTER_VALIDATE_EMAIL) && !empty($email)) {
$error_message = 'Please provide a valid email address.';
} else {
echo '<pre>';
var_dump($name, $phone, $email, $address, $service_type, $preferred_date, $description, $contract_id);
echo '</pre>';
try {
$pdo = db();
$sql = "INSERT INTO service_requests (name, phone, email, address, service_type, preferred_date, description, contract_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
@ -46,6 +54,8 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$form_data = array_fill_keys(array_keys($form_data), '');
} catch (PDOException $e) {
// Debugging: show exact error
var_dump($e->getMessage());
error_log("Service Request Error: " . $e->getMessage());
$error_message = 'Sorry, there was an error submitting your request. Please try again later.';
}