exec($sql); } catch (PDOException $e) { die("Could not create table: " . $e->getMessage()); } $message = ''; $error = ''; if ($_SERVER["REQUEST_METHOD"] == "POST") { $patient_name = trim($_POST['patient_name']); $patient_dob = trim($_POST['patient_dob']); $blood_type = trim($_POST['blood_type']); $organ_needed = trim($_POST['organ_needed']); $urgency_level = trim($_POST['urgency_level']); $contact_phone = trim($_POST['contact_phone']); $contact_email = trim($_POST['contact_email']); $hospital_id = $_SESSION['hospital_id']; if (empty($patient_name) || empty($patient_dob) || empty($blood_type) || empty($organ_needed) || empty($urgency_level) || empty($contact_phone) || empty($contact_email)) { $error = "All fields are required."; } else { $sql = "INSERT INTO recipients (hospital_id, patient_name, patient_dob, blood_type, organ_needed, urgency_level, contact_phone, contact_email) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; $stmt = $pdo->prepare($sql); try { $stmt->execute([$hospital_id, $patient_name, $patient_dob, $blood_type, $organ_needed, $urgency_level, $contact_phone, $contact_email]); $message = "Recipient registered successfully!"; } catch (PDOException $e) { $error = "Error: " . $e->getMessage(); } } } ?> Recipient Registration - Organ Donation

Register New Recipient