-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathallUsers.php
More file actions
82 lines (67 loc) · 2.73 KB
/
allUsers.php
File metadata and controls
82 lines (67 loc) · 2.73 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
70
71
72
73
74
75
76
77
78
79
80
81
<?php include "head.inc.php" ?>
<body class="backstore">
<?php include "header.html" ?>
<div class="container">
<script>
function contentGenerate(){
var tempUsers = document.getElementById("selectUser").options[document.getElementById("selectUser").selectedIndex].text;
var element = null;
for(var i = 0; i < userArray.length; i++){
if(tempUsers == userArray[i].email){
element = userArray[i];
}
}
if(element == null){
document.getElementById("table1").innerHTML = "";
}
else {
document.getElementById("table1").innerHTML = '<tr>' +
'<th colspan=0> User Specifics </th> <td> <input type="submit" name="update" value="Edit"></input> <input type="submit" name="delete" value="Delete"></input> </td>' +
'</tr>' +
'<tr>' +
'<th> First Name <input type="text" name="firstName" value="' + element.firstName + '"></th>' +
'<th> Last Name <input type="text" name="lastName" value="' + element.lastName + '"></th>' +
'<th> Email <input type="text" name="email" value="' + element.email + '"></th>' +
'<th> Password <input type="text" name="password" value="' + element.password + '"></th>' +
'<th> User ID <input type="text" name="ID" readonly value="' + element.id + '"></th>' +
'<th> Admin <input type="checkbox" id="admin" name="admin" value="admin"></th>' +
'</tr>';
if(element.admin == "true"){
document.getElementById("admin").checked = true;
}
}
}
</script>
Product List :
<select id="selectUser">
<option value="">--- Select ---</option>
</select>
<button class="selectorButton" type="submit" name="Submit" value="Select" onclick="contentGenerate();"> Select </button>
<script>
var userArray = getUsers();
var selectUserID = document.getElementById("selectUser");
var string = '<option value="">--- Select ---</option>';
for(var i = 0; i < userArray.length; i++){
string = string.concat('<option name="'+ userArray[i].id + '" value=""> ' + userArray[i].email + '</option>');
}
document.getElementById("selectUser").innerHTML = string;
</script>
<form method="POST" action="deleteUser.php"><table id="table1"></table></form>
<form method="POST" action="addUser.php">
<table align='center' cellspacing=2 cellpadding=5 id="data_table" border=0>
<tr>
<th colspan=0>Add New User</th> <td> <input class="selectorButton" type="submit" name="add" value="Add"></td>
</tr>
<tr>
<th> First Name <input type="text" name="firstName"></th>
<th> Last Name <input type="text" name="lastName"></th>
<th> Email <input type="text" name="email"></th>
<th> Password <input type="text" name="password"></th>
<th> Admin <input type="checkbox" name="admin"></th>
</tr>
</form>
</table>
</div>
</body>
<?php include "footer.html" ?>
</html>