-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfacultyreport.php
More file actions
67 lines (54 loc) · 2.08 KB
/
facultyreport.php
File metadata and controls
67 lines (54 loc) · 2.08 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
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
<html>
<head>
<title>Faculty Portal</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
<link rel="stylesheet" href="new.css">
</head>
<?php
session_start();
$mysqli = new mysqli("localhost", "cs340", "cs340_s19", "courseeval");
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
echo "Please try again.";
}
?>
<div id="nav"><a href="http://34.73.123.138/"><button type="button" class="btn btn-default" >Home</button></a></div>
<div class="container">
<body>
<h2>Please enter your instructor ID</h2>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="post">
<div class="form-group">
<input type="text" class="form-control" id="instructorID " name="instructorID" aria-describedy="instructorID" placeholder="Enter Instructor ID">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
<br><br>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST"){
$instructorID = $_POST["instructorID"];
$_SESSION["instructorID"] = $instructorID;
echo '<h2>Select one of your classes to see statistics:</h2>';
$classes = $mysqli->query("select class_num from teaches where instructorid='$instructorID';");
if ($classes){
if ($classes->num_rows == 0){
echo 'You have not taught any classes.';
} else {
$classes->data_seek(0);
echo '
<form action="facultystatistics.php" method="post">
<div class="form-group">
<select class="form-control" id="class_num" name="class_num">';
while ($row = $classes->fetch_assoc()){
echo '<option>' . $row["class_num"] . '</option>';
}
echo '</select></div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>';
}
} else {echo 'no classes';}
}
session_write_close();
?>
</div>
</body>
</hmtl>