-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsearchRequests.php
More file actions
69 lines (54 loc) · 1.91 KB
/
searchRequests.php
File metadata and controls
69 lines (54 loc) · 1.91 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
68
69
<?php
session_start();
if(!isset($_SESSION['loggedin'])){
header('Location: login.php');
exit();
}
if ($_SESSION['username'] != 'administrator'){
header('Location: index.php?adminonly=1');
}
?>
<div id="request_button" class=" bootstrap-iso eq" style="margin-top: 10px">
<div style="position: center" align="center" id="searchEq">
<label for="requestSelect" style="margin-top: 20px">Search:</label>
<select id="requestSelect" style="width: 50%; text-align: left;margin-bottom: 10px" onchange="change()" >
<?php
$returnResult = mysqli_query($db,"select * from EqManage.requests");
while ($row = mysqli_fetch_array($returnResult)){
echo "<option value=\"\">Select User</option>";
$ID = $row['id'];
$date = $row['requestDate'];
echo "<option value='$ID'>ID: $ID | Request Date: $date</option>";
};
?>
</select>
</div>
</div>
<div id="request" class="bootstrap-iso eq" style="margin-top: 10px">
<?php include('fetchSearchRequests.php') ?>
</div>
</div>
<script>
$(document).ready(function() {
$("#requestSelect").change(function () {
var id = $(this).val();
console.log("Working");
var url = 'fetchSearchRequests.php?' + 'id=' + id;
console.log(url);
$("#request").load(url);
console.log("Done");
})});
$("#requestSelect").select2( {
placeholder: "Enter user ID",
allowClear: true,
} );
function change() {
var e = document.getElementById("requestSelect");
var id = e.options[e.selectedIndex].value;
console.log(id);
var url = 'fetchSearchRequests.php?' + 'id=' + id;
console.log(url);
$("#request").load(url);
console.log("Done");
}
</script>