forked from HagopA/COMP353
-
Notifications
You must be signed in to change notification settings - Fork 0
/
frontEnd.php
76 lines (74 loc) · 2.59 KB
/
frontEnd.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
<!DOCTYPE HTML>
<html>
<head>
<title>Warm-up Project</title>
<meta charset="utf-8"/>
<script src = "frontEnd.js"></script>
</head>
<body>
<h1> Select a query </h1>
<form method = "post">
<select name="question">
<option value="membersFromTID"> Given a TID, list the names of the members.</option>
<option value="membersDemo"> Given a date, list all the teams that had demos on that day.</option>
<option value="teamFromTID"> Given a student name or ID, find his or her team.</option>
<option value="teamMates"> Given a student name or ID, find the names and the SID of his or her team mates.</option>
<option value="teamMember"> Which student(s) is not a member of any team?</option>
<option value="listMembers"> For each team, list its members.</option>
<option value="notPresent"> Who was not present in the demo of a team?</option>
<option value="lessThanFour"> List the teams which have <4 members.</option>
<option value="incompleteTeamTID"> For each team that is not complete, list the TID and the capacity to increase.</option>
</select>
<br/>
<br/>
<input id="textBox" name = "textB" type = "text"/>
<br/>
<input type="submit"/>
</form>
<?php
require 'ConnectToDB.php';
if(isset($_POST['question']))
{
$PDOresults;
switch ($_POST['question'])
{
case "membersFromTID":
$PDOresults = getListOfTeamMembers($_POST['textB']);
break;
case "membersDemo":
$PDOresults = getTeamsWhoHaveDemos($_POST['textB']);
break;
case "teamFromTID":
$PDOresults = getTeamIdByStudent($_POST['textB']);
break;
case "teamMates":
$PDOresults = getTeammatesByStudent($_POST['textB']);
break;
case "teamMember":
$PDOresults = getStudentsNotInATeam();
break;
case "listMembers":
$PDOresults = getListOfMembersOnTeams();
break;
case "notPresent":
$PDOresults = getStudentsNotInDemos();
break;
case "lessThanFour":
$PDOresults = getTeamsWithLessThanFourMembers();
break;
case "incompleteTeamTID":
$PDOresults = getTeamsCapacityToIncrease();
break;
}
while($PDOresults != NULL && $row = $PDOresults->fetch(PDO::FETCH_ASSOC))
{
foreach($row as $column)
{
echo $column." ";
}
echo'<br/>';
}
}
?>
</body>
</html>