What I want is to be able to select a user id and pull up data based off that user id. Then if the user wants to look at a specific year select a year and retrieve data for that specific user. I got that to work but I need to be able to click on the buttons and get them to retrieve specific data.
I need to know how to setup for multiple request. I really want to be able to call from different php functions. Hope someone can help!
exa.jpg
PHP Code:
<?php include '../Common/.phplib/db.php'; ?>
HTML Code:
<html>
<head>
<script type="text/javascript">
function saveUser(userid)
{
var year=document.getElementById('theyear').value;
var userid;
var year;
showUser(userid,year);
}
function saveYear(year)
{
var userid=document.getElementById('theuser').value;
var userid;
var year;
showUser(userid,year);
}
function showUser(userid,year)
{
if (userid =="" && year =="")
{
document.getElementById("txtHint").innerHTML="";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","Status_23Gs.php?q="+userid+"&year="+year,true);
xmlhttp.send();
}
</script>
</head>
<body>
PHP Code:
<?php
$query="SELECT uuid,auth,emp FROM auto_atp.Admin ORDER BY uuid";
$result=mysql_query($query);
$options="";
while($row = mysql_fetch_array($result)){
$id=$row['uuid'];
$users=$row['uuid'];
$options.="<OPTION VALUE=\"$id\">".$users;
}
?>
HTML Code:
<br />
<div><h1>Status Report</h1>
</div>
<b>UUID:</b><select id="theuser" name="users" onchange="saveUser(this.value)">
<OPTION VALUE=0><b>UID</b>
[PHP]<?=$options?>[/PHP]
</SELECT>
<input type="button" id="allbutton" value="ALL" onClick="showUser();" title="View all ATP for the year of $year">
<input type="button" value="Complete" onClick="showallcompleted'" title="View all passed ATP for the year of $year">
PHP Code:
<?php
$query="SELECT serial,year FROM auto_atp.GeoProbe GROUP BY year ORDER BY year";
$result=mysql_query($query);
$options="";
while($row = mysql_fetch_array($result)){
$RES=$row['year'];
$options.="<OPTION VALUE=\"$RES\">".$RES;
}
?>
HTML Code:
<select id="theyear" name="year" onchange="saveYear(this.value)">
<OPTION VALUE=0>
[PHP]<?=$options?>[/PHP]
</SELECT>
<div id="txtHint"><b></b></div>
</body>
</html>
*****Status_23Gs.php ******
PHP Code:
<?php
$all = $_GET['allbutton'];
if(isset($_POST['allbutton']))
{
echo "YES";
}else{
echo "No";
}
if (isset ($_GET["year"])) {
$year = $_GET["year"];
} else {
$year = date('Y');
}
$q=$_GET['q'];
$query = "SELECT * FROM auto_atp WHERE year = '".$year."' AND attuuid='".$q."'";
$result = mysql_query($query) or die(mysql_error());
var_dump($query);
echo "<table CELLPADDING=10 border =1 >";
echo "<tr>";
echo "<th>Network</th>";
echo "<th>Region</th>";
while($row = mysql_fetch_array($result)){
$network = $row['network'];
$region = $row['region'];
echo "<tr>";
echo "<td>".$network."</td>";
echo "<td>".$region."</td>";
echo "</tr>";
}
echo "</table>";
?>
Bookmarks