98 lines
4.5 KiB
PHP
98 lines
4.5 KiB
PHP
<?php
|
|
require_once 'db/config.php';
|
|
|
|
$doctor = null;
|
|
$error_message = '';
|
|
|
|
if (isset($_GET['id'])) {
|
|
try {
|
|
$db = db();
|
|
$doctorId = $_GET['id'];
|
|
|
|
$stmt = $db->prepare("SELECT d.full_name, d.email, d.specialty, d.qualifications, d.specialities, d.contact_phone, d.license_number, d.consultation_fee, d.availability, h.hospital_name, h.address, h.city, h.state, h.country FROM doctors d LEFT JOIN hospitals h ON d.hospital_id = h.id WHERE d.id = ?");
|
|
$stmt->execute([$doctorId]);
|
|
$doctor = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
|
|
if (!$doctor) {
|
|
$error_message = "Doctor not found.";
|
|
}
|
|
|
|
} catch (PDOException $e) {
|
|
$error_message = "Database error: " . $e->getMessage();
|
|
}
|
|
} else {
|
|
$error_message = "No doctor ID provided.";
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Doctor Profile - Medicaltour</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link rel="stylesheet" href="assets/css/custom.css">
|
|
</head>
|
|
<body>
|
|
|
|
<!-- Navigation -->
|
|
<nav class="navbar navbar-expand-lg navbar-light bg-light fixed-top">
|
|
<div class="container">
|
|
<a class="navbar-brand" href="index.php">Medicaltour</a>
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
<div class="collapse navbar-collapse" id="navbarResponsive">
|
|
<ul class="navbar-nav ms-auto">
|
|
<li class="nav-item"><a class="nav-link" href="index.php">Home</a></li>
|
|
<li class="nav-item"><a class="nav-link" href="login.php">Login</a></li>
|
|
<li class="nav-item"><a class="nav-link" href="patient-registration.php">Register</a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<!-- Page Content -->
|
|
<main class="container mt-5 pt-5">
|
|
<section id="doctor-profile" class="py-5">
|
|
<div class="row">
|
|
<div class="col-md-8 mx-auto">
|
|
<?php if ($error_message): ?>
|
|
<div class="alert alert-danger"><?php echo $error_message; ?></div>
|
|
<?php elseif ($doctor): ?>
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<h2 class="card-title text-center mb-4"><?php echo htmlspecialchars($doctor['full_name']); ?></h2>
|
|
<p class="card-text"><strong>Primary Specialty:</strong> <?php echo htmlspecialchars($doctor['specialty']); ?></p>
|
|
<p class="card-text"><strong>Qualifications:</strong> <?php echo nl2br(htmlspecialchars($doctor['qualifications'])); ?></p>
|
|
<p class="card-text"><strong>Additional Specialities:</strong> <?php echo nl2br(htmlspecialchars($doctor['specialities'])); ?></p>
|
|
<p class="card-text"><strong>Contact Phone:</strong> <?php echo htmlspecialchars($doctor['contact_phone']); ?></p>
|
|
<p class="card-text"><strong>Consultation Fee:</strong> $<?php echo htmlspecialchars($doctor['consultation_fee']); ?></p>
|
|
<p class="card-text"><strong>Availability:</strong> <?php echo nl2br(htmlspecialchars($doctor['availability'])); ?></p>
|
|
|
|
<?php if ($doctor['hospital_name']): ?>
|
|
<hr>
|
|
<h4>Affiliated Hospital</h4>
|
|
<p><?php echo htmlspecialchars($doctor['hospital_name']); ?></p>
|
|
<p><?php echo htmlspecialchars($doctor['address']); ?>, <?php echo htmlspecialchars($doctor['city']); ?>, <?php echo htmlspecialchars($doctor['state']); ?>, <?php echo htmlspecialchars($doctor['country']); ?></p>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</main>
|
|
|
|
<!-- Footer -->
|
|
<footer class="py-5 bg-dark text-white mt-auto">
|
|
<div class="container text-center">
|
|
<p>© 2025 Medicaltour. All Rights Reserved.</p>
|
|
</div>
|
|
</footer>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
|
<script src="assets/js/main.js"></script>
|
|
</body>
|
|
</html>
|