/
admissions.php
77 lines (63 loc) · 2.09 KB
/
admissions.php
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
session_start();
// Redirect to login page if not logged in
if(empty($_SESSION['username'])) { header("Location: login.php"); }
// Open database connection
require 'db_connection.php';
function getAdmissionsInfo() {
global $dbConn;
$sql = "SELECT admissions_offices.phone, admissions_offices.website, public_universities.name, public_universities.img
FROM admissions_offices
INNER JOIN public_universities
ON public_universities.public_university_id = admissions_offices.public_university_id
WHERE admissions_offices.public_university_id = :univId";
$stmt = $dbConn -> prepare($sql);
$stmt -> execute(array (":univId" => $_GET['id']));
return $stmt->fetch();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="author" content="Heather McCabe">
<title>Admissions Information</title>
<link rel="stylesheet" type="text/css" href="univ.css">
</head>
<body>
<?php include 'navBar.php' ?>
<div id="admissionsInfo">
<?php
// Get university admissions info
$univInfo = getAdmissionsInfo();
?>
<table>
<tr>
<th><img src="./images/<?= $univInfo['img'] ?>"></th>
<td><b><?= htmlentities($univInfo['name']) ?></b><br>
<?= $univInfo['phone'] ?><br>
<a href='<?= $univInfo['website'] ?>'><?= $univInfo['website'] ?></a>
</td>
</tr>
<tr><td colspan="2">
<form method='post' action='updateList.php' style="display: inline">
<input type="hidden" name="redirect" value="admissions.php?id=<?=$_GET['id']?>">
<input type="hidden" name="univId" value=<?=$_GET['id']?>>
<?php
include 'updateList.php';
if (inUserList($_GET['id'])) {
echo '<input type="submit" name="remove" value="Remove from My List">';
} else {
echo '<input type="submit" name="add" value="Add to My List">';
}
?>
</form>
<form action="findSchool.php" style="display: inline;">
<input type="submit" value="Go Back">
</form>
</td></tr>
</table>
</div>
</body>
<?php $dbConn = null; // Close connection ?>
</html>