-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBBIS_teamA.php
102 lines (97 loc) · 3.03 KB
/
BBIS_teamA.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
<html>
<head>
<script>
function showRows(str) {
if (str == "") {
document.getElementById("Datashow").innerHTML = "Incomplete Request!";
return;
} else {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("Datashow").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET","rows.php?q="+str,true);
xmlhttp.send();
}
}
function getParameter() {
var ops = document.getElementById("Operations");
var ops_str = ops.options[ops.selectedIndex].value;
if (ops_str == "") return;
var tbs = document.getElementById("Tables");
var tbs_str = tbs.options[tbs.selectedIndex].value;
if (tbs_str == "") return;
var request = ops_str + "&t=" + tbs_str;
if (ops_str == "3" || ops_str == "4") {
var sele = document.getElementById("RetSelect");
var sid = sele.options[sele.selectedIndex].value;
if (sid == "") return;
request += "&d=" + sid;
}
if (ops_str != "3") {
var num_str = document.getElementById("RetNumber").value;
request += "&n=" + num_str;
var num = parseInt(num_str);
var values = document.getElementsByName("RetValues");
for (var i = 0; i < num; i++) {
request += "&v" + i.toString() + "=" + values[i].value;
}
}
showRows(request);
}
function process_form(ostr,tstr) {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("Commands").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET", "columns.php?q="+ostr+"&t="+tstr,true);
xmlhttp.send();
}
function getOperation(str) {
if (str == "") return;
var tbs = document.getElementById("Tables");
var tbs_str = tbs.options[tbs.selectedIndex].value;
if (tbs_str == "") return;
process_form(str,tbs_str);
}
function getTable(str) {
if (str == "") return;
var ops = document.getElementById("Operations");
var ops_str = ops.options[ops.selectedIndex].value;
if (ops_str == "") return;
process_form(ops_str, str);
}
</script>
</head>
<body>
<p align="right" style="font-size:20"><a href="index.php" style="text-align:right">logout</a></p>
<h2> Barkley Brothers Information System (BBIS) </h2>
<form>
<select id="Operations" onchange="getOperation(this.value)">
<option value="">Select an Operation:</option>
<option value="1">Search</option>
<option value="2">Add</option>
<option value="3">Delete</option>
<option value="4">Modify</option>
</select>
<select id="Tables" onchange="getTable(this.value)">
<option value="">Select a Table:</option>
<option value="1">Property</option>
<option value="2">Buyer</option>
<option value="3">Seller</option>
<option value="4">Agent</option>
<option value="5">Office</option>
</select>
<button type="button" onclick="getParameter()">Execute!</button>
<br>
<div id="Commands"></div>
</form>
<br>
<div id="Datashow"></div>
<p> <small> Developed by Group Team-A. 2014 </small> </p>
</body>
</html>