diff --git a/add_patient.php b/add_patient.php
new file mode 100644
index 0000000..a20e19c
--- /dev/null
+++ b/add_patient.php
@@ -0,0 +1,34 @@
+ false, 'message' => 'An error occurred.'];
+
+if ($_SERVER['REQUEST_METHOD'] === 'POST') {
+ $name = trim($_POST['name'] ?? '');
+ $lastname = trim($_POST['lastname'] ?? '');
+ $age = trim($_POST['age'] ?? '');
+ $insurance = trim($_POST['insurance'] ?? '');
+ $symptoms = trim($_POST['symptoms'] ?? '');
+ $specialty = trim($_POST['specialty'] ?? '');
+ $pre_arrival_instructions = trim($_POST['pre_arrival_instructions'] ?? '');
+
+ if (empty($name) || empty($lastname) || empty($age) || empty($insurance) || empty($symptoms) || empty($specialty) || empty($pre_arrival_instructions)) {
+ $response['message'] = 'Please fill in all required fields.';
+ } else {
+ try {
+ $pdo = db();
+ $sql = "INSERT INTO patients (name, lastname, age, insurance, symptoms, specialty, pre_arrival_instructions) VALUES (?, ?, ?, ?, ?, ?, ?)";
+ $stmt = $pdo->prepare($sql);
+ $stmt->execute([$name, $lastname, $age, $insurance, $symptoms, $specialty, $pre_arrival_instructions]);
+
+ $response['success'] = true;
+ $response['message'] = 'Patient data submitted successfully!';
+ } catch (PDOException $e) {
+ $response['message'] = 'Database error: ' . $e->getMessage();
+ }
+ }
+}
+
+echo json_encode($response);
diff --git a/assets/css/custom.css b/assets/css/custom.css
new file mode 100644
index 0000000..9c7fee1
--- /dev/null
+++ b/assets/css/custom.css
@@ -0,0 +1,7 @@
+body {
+ background-color: #F8F9FA;
+}
+
+.card {
+ border-radius: 0.5rem;
+}
diff --git a/assets/js/main.js b/assets/js/main.js
new file mode 100644
index 0000000..b1b7bee
--- /dev/null
+++ b/assets/js/main.js
@@ -0,0 +1,46 @@
+document.addEventListener('DOMContentLoaded', function () {
+ const patientForm = document.getElementById('patient-form');
+ const successMessage = document.getElementById('success-message');
+
+ patientForm.addEventListener('submit', function (event) {
+ event.preventDefault();
+
+ if (validateForm()) {
+ const formData = new FormData(patientForm);
+
+ fetch('add_patient.php', {
+ method: 'POST',
+ body: formData
+ })
+ .then(response => response.json())
+ .then(data => {
+ if (data.success) {
+ successMessage.classList.remove('d-none');
+ patientForm.reset();
+ } else {
+ alert('Error: ' + data.message);
+ }
+ })
+ .catch(error => {
+ console.error('Error:', error);
+ alert('An error occurred while submitting the form.');
+ });
+ }
+ });
+
+ function validateForm() {
+ let isValid = true;
+ const inputs = patientForm.querySelectorAll('input[required], textarea[required]');
+
+ inputs.forEach(input => {
+ if (!input.value.trim()) {
+ isValid = false;
+ input.classList.add('is-invalid');
+ } else {
+ input.classList.remove('is-invalid');
+ }
+ });
+
+ return isValid;
+ }
+});
diff --git a/db/config.php b/db/config.php
index bb98f7d..93f9c37 100644
--- a/db/config.php
+++ b/db/config.php
@@ -1,17 +1,15 @@
PDO::ERRMODE_EXCEPTION,
- PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
- ]);
- }
- return $pdo;
-}
+ try {
+ $pdo = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USER, DB_PASS);
+ $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+ return $pdo;
+ } catch (PDOException $e) {
+ die('Connection failed: ' . $e->getMessage());
+ }
+}
\ No newline at end of file
diff --git a/index.php b/index.php
index 7205f3d..840cc8e 100644
--- a/index.php
+++ b/index.php
@@ -1,150 +1,70 @@
-
-
+
-
-
- New Style
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ SdC - Patient Transfer
+
+
+
+
+
+
+
+
+
-
-
-
Analyzing your requirements and generating your website…
-
- Loading…
-
-
= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.
-
This page will update automatically as the plan is implemented.
-
Runtime: PHP = htmlspecialchars($phpVersion) ?> — UTC = htmlspecialchars($now) ?>
-
-
-
+
+ Patient Transfer Request
+
+
+
+
+
New Patient
+
+
+ Patient data submitted successfully!
+
+
+
+
+
-
+