forked from Praveen-R-2518/Uni-DMS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuniversities.php
More file actions
31 lines (30 loc) · 1.39 KB
/
universities.php
File metadata and controls
31 lines (30 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
// universities.php - List all universities dynamically
include 'includes/header.php';
include 'includes/db.php';
// Fetch universities from DB
$sql = "SELECT * FROM universities";
$result = $conn->query($sql);
?>
<section class="container">
<h1>Universities in Sri Lanka</h1>
<input type="text" id="searchInput" placeholder="Search universities..." style="margin-bottom:1rem; padding:0.5rem; width:100%; max-width:400px;">
<div class="cards">
<?php if ($result && $result->num_rows > 0): ?>
<?php while($row = $result->fetch_assoc()): ?>
<div class="card">
<h2><?php echo htmlspecialchars($row['name']); ?></h2>
<p><?php echo htmlspecialchars($row['location']); ?></p>
<p><?php echo htmlspecialchars($row['description']); ?></p>
<?php if (!empty($row['image'])): ?>
<img src="images/<?php echo htmlspecialchars($row['image']); ?>" alt="<?php echo htmlspecialchars($row['name']); ?>" style="max-width:100%;height:auto;">
<?php endif; ?>
<a href="university.php?id=<?php echo $row['id']; ?>" class="btn">View Details</a>
</div>
<?php endwhile; ?>
<?php else: ?>
<p>No universities found.</p>
<?php endif; ?>
</div>
</section>
<?php include 'includes/footer.php'; ?>