prepare("SELECT id FROM hospitals WHERE email = ?"); $stmt->execute([$email]); if ($stmt->fetch()) { $error_message = "A hospital with this email is already registered."; } else { $hashed_password = password_hash($password, PASSWORD_BCRYPT); $sql = "INSERT INTO hospitals (name, email, phone, address, password) VALUES (?, ?, ?, ?, ?)"; $stmt = $pdo->prepare($sql); $stmt->execute([$name, $email, $phone, $address, $hashed_password]); $hospital_id = $pdo->lastInsertId(); $_SESSION['user_id'] = $hospital_id; $_SESSION['user_type'] = 'hospital'; $_SESSION['user_email'] = $email; header("Location: dashboard.php"); exit; } } catch (PDOException $e) { $error_message = "Database error: " . $e->getMessage(); // In a real application, you would log this error, not show it to the user } } } ?> <?= htmlspecialchars($page_title) ?> - Organ Donation

Organ Donation Management