forked from Jmurrietasmith/EqManage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearchLog.php
69 lines (54 loc) · 1.88 KB
/
searchLog.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
<?php
session_start();
if(!isset($_SESSION['loggedin'])){
header('Location: login.php');
exit();
}
if ($_SESSION['username'] != 'administrator'){
header('Location: index.php?adminonly=1');
}
?>
<div id="log_button" class=" bootstrap-iso eq" style="margin-top: 10px">
<div style="position: center" align="center" id="searchEq">
<label for="logSelect" style="margin-top: 20px">Search:</label>
<select id="logSelect" style="width: 50%; text-align: left;margin-bottom: 10px" onchange="change()" >
<?php
$returnResult = mysqli_query($db,"select * from EqManage.log");
while ($row = mysqli_fetch_array($returnResult)){
echo "<option value=\"\">Select User</option>";
$ID = $row['id'];
$date = $row['checkoutRequestDate'];
echo "<option value='$ID'>ID: $ID | Initial Checkout Request Date: $date</option>";
};
?>
</select>
</div>
</div>
<div id="log" class="bootstrap-iso eq" style="margin-top: 10px">
<?php include('fetchSearchLog.php') ?>
</div>
</div>
<script>
$(document).ready(function() {
$("#logSelect").change(function () {
var id = $(this).val();
console.log("Working");
var url = 'fetchSearchEq.php?' + 'id=' + id;
console.log(url);
$("#user").load(url);
console.log("Done");
})});
$("#logSelect").select2( {
placeholder: "Enter user ID",
allowClear: true,
} );
function change() {
var e = document.getElementById("logSelect");
var id = e.options[e.selectedIndex].value;
console.log(id);
var url = 'fetchSearchLog.php?' + 'id=' + id;
console.log(url);
$("#log").load(url);
console.log("Done");
}
</script>