-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstudentneedpickup.php
125 lines (73 loc) · 2.65 KB
/
studentneedpickup.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php
session_start();
?>
<?php
if(!isset($_SESSION['id'])){
die(header("Location: error.php"));
}
?>
<?php
include("adminnav.php");
include("project3connection.php");
?>
<br><br><br>
<?php
$student = $volunteer = '';
if($_SERVER["REQUEST_METHOD"] == "POST"){
$student = $_POST['student'];
$volunteer = $_POST['volunteer'];
$q1 = "SELECT * FROM pickup WHERE s_id = '$student'";
$q1 = mysqli_query($dbc, $q1);
$num = mysqli_num_rows($q1);
if($num=0){
$query = "INSERT INTO pickup(s_id, v_id, approved) VALUES('$student','$volunteer','1')";
}
else{
echo" <script>";
echo 'alert("Student already has been assigned");';
echo" </script>";
}
}
?>
<html>
<head>
<title>Student need Pickup</title>
<style>
</style>
</head>
<body>
<form action ='<?php echo htmlspecialchars($_SERVER['PHP_SELF']);?>'method ='post' style = "text-align: center">
You want to assign student: (Enter student id)<input type ="text" name= "student" value = "<?php echo$student;?>">
to Volunteer(Enter volunteer id)<input type ="text" name= "volunteer" value = "<?php echo$volunteer;?>"><br><br>
<input type ="submit" name= "submit" value= "Click Here to Confirm">
</body>
</html>
<?php
include("project3connection.php");
$q1 = "SELECT s_id FROM pickup";
$result = mysqli_query($dbc,$q1);
$data = array();
while($row = mysqli_fetch_array($result)){
$data[] = $row[0];
}
$query = " SELECT *FROM student
WHERE pickup ='yes' AND s_id NOT IN ('" . implode("', '", $data) . "') ";
$q = mysqli_query($dbc,$query);
echo"<h1>Students who have not been assign to pickup: </h1>";
echo"<table border ='3' align = 'center' cellspacing='3' width='75%' height ='10%' background-color:grey>";
echo"<tr style='font-weight:bold; font-size:1.1em; text-align: center; background-color:pink'> <td> S_Id </td> < <td> Last Name </td> <td> First Name </td>
<td> F/M </td> <td> Arr Date </td><td> Arr Time </td> <td> FN </td> <td> BigLug </td> </tr>";
while($row = mysqli_fetch_array($q)){
echo"<tr style = 'text-align: center; background-color:#90FFF0'>";
echo"<td>".$row['s_id']."</td>";
echo"<td>".$row['lastName']."</td>";
echo"<td>".$row['firstName']."</td>";
echo"<td>".$row['gender']."</td>";
echo"<td>".$row['aDate']."</td>";
echo"<td>".$row['aTime']."</td>";
echo"<td>".$row['aflightnum']."</td>";
echo"<td>".$row['biglug']."</td>";
echo"</tr>";
}
echo"</table>";
?>