same
This commit is contained in:
parent
b4ffcec973
commit
e825aa97f2
@ -1,4 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// Debugging: Dump POST data
|
||||||
|
echo '<pre>';
|
||||||
|
var_dump($_POST);
|
||||||
|
echo '</pre>';
|
||||||
|
|
||||||
require_once 'db/config.php';
|
require_once 'db/config.php';
|
||||||
|
|
||||||
// Fetch all contracts for the dropdown
|
// Fetch all contracts for the dropdown
|
||||||
@ -30,6 +35,9 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
} elseif (!filter_var($email, FILTER_VALIDATE_EMAIL) && !empty($email)) {
|
} elseif (!filter_var($email, FILTER_VALIDATE_EMAIL) && !empty($email)) {
|
||||||
$error_message = 'Please provide a valid email address.';
|
$error_message = 'Please provide a valid email address.';
|
||||||
} else {
|
} else {
|
||||||
|
echo '<pre>';
|
||||||
|
var_dump($name, $phone, $email, $address, $service_type, $preferred_date, $description, $contract_id);
|
||||||
|
echo '</pre>';
|
||||||
try {
|
try {
|
||||||
$pdo = db();
|
$pdo = db();
|
||||||
$sql = "INSERT INTO service_requests (name, phone, email, address, service_type, preferred_date, description, contract_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
|
$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), '');
|
$form_data = array_fill_keys(array_keys($form_data), '');
|
||||||
|
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
|
// Debugging: show exact error
|
||||||
|
var_dump($e->getMessage());
|
||||||
error_log("Service Request Error: " . $e->getMessage());
|
error_log("Service Request Error: " . $e->getMessage());
|
||||||
$error_message = 'Sorry, there was an error submitting your request. Please try again later.';
|
$error_message = 'Sorry, there was an error submitting your request. Please try again later.';
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user