exec($sql); } catch (PDOException $e) { die("Could not create table: " . $e->getMessage()); } if ($_SERVER["REQUEST_METHOD"] == "POST") { $hospital_name = trim($_POST['hospital_name']); $email = trim($_POST['email']); $password = $_POST['password']; $phone = trim($_POST['phone']); $address = trim($_POST['address']); if (empty($hospital_name) || empty($email) || empty($password)) { $message = '
Please fill in all required fields.
'; } else { try { $pdo = db(); // Check if email already exists $stmt = $pdo->prepare("SELECT id FROM hospitals WHERE email = ?"); $stmt->execute([$email]); if ($stmt->fetch()) { $message = '
This email address is already registered.
'; } else { // Hash the password $hashed_password = password_hash($password, PASSWORD_DEFAULT); $sql = "INSERT INTO hospitals (hospital_name, email, password, phone, address) VALUES (?, ?, ?, ?, ?)"; $stmt = $pdo->prepare($sql); $stmt->execute([$hospital_name, $email, $hashed_password, $phone, $address]); $message = '
Hospital registered successfully! You will be able to log in once the admin verifies your account.
'; } } catch (PDOException $e) { $message = '
Error: ' . $e->getMessage() . '
'; } } } ?> Hospital Registration - Organ Donation Management System

Hospital Registration

Register your hospital to manage recipient information.

iv>