I have a form that has 3 dropdowns and 3 checkboxes. I have the form setup so that if any one of the items changes it will re-run the query based on the values on the form. I have this working for the first list as its month. I can't seem to get the other variables to pass to the .js file. I guess i want to pass an array to the .js file and then break it out in the php file for the query.
right now the query is not setup for multiple values, and i can change that. I need to know how to get the values from all form items anytime one element changes.
Thanks
This is the form:
<form class="shifty" o>
<div class="manuallabel"><label>Select a month for Points Awards:</label></div>
<div class="manualfield">
<select size="1" id="month" name="month" onchange="showHint(this.value)">
<option value="">Select Month</option>
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>
<input name="view_all_months" type="checkbox" value="1" checked/>View all months
</div>
<br />
<div class="manuallabel"><label>Select Type of Award to View:</label></div>
<div class="manualfield">
<select name="type" id="type" width="100px" size="1" onchange="showHint(this.value)">
<option value="">Select Award</option>
<?php
$cv = mysqli_connect("localhost","root","dinom1980");
$rowcount = 0;
mysqli_select_db($cv,"tech_points");
$q = mysqli_query($cv,"select * from points_itemkey order by item_description");
while ($abc = mysqli_fetch_row($q)) {
print "<option value =\"". htmlspecialchars($abc[0]) ."\">"
.htmlspecialchars($abc[1]) ."</option>";
}
?>
</select>
<input name="view_all_months" type="checkbox" value="1" checked/>View all Awards
</div>
<br />
<div class="manuallabel"><label>Select Type of Redemption View:</label></div>
<div class="manualfield">
<select name="type" id="redeem" width="100px" size="1" onchange="showHint(this.value)">
<option value="">Select Redemption</option>
<?php
$cv = mysqli_connect("localhost","root","dinom1980");
$rowcount = 0;
mysqli_select_db($cv,"tech_points");
$q = mysqli_query($cv,"select * from redemption_itemkey order by item_no");
while ($abc = mysqli_fetch_row($q)) {
print "<option value =\"". htmlspecialchars($abc[0]) ."\">"
.htmlspecialchars($abc[1]) ."</option>";
}
?>
</select>
<input name="view_all_months" type="checkbox" value="1" checked/>View all Redemptions
</div>
<br />
<div class="manualfield"><input name="" type="reset" /></div>
<p>Your Results:<br />
<span id="txtHint"></span></p>
</form>
and this is the src=clientinfo.js file
var xmlhttp
function showHint(str, type, redeem)
{
if (str.length==0)
{
document.getElementById("txtHint").innerHTML="";
return;
}
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
{
alert ("Your browser does not support XMLHTTP!");
return;
}
var url="gethint2.php";
url=url+"?month="+str;
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
function stateChanged()
{
if (xmlhttp.readyState==4)
{
document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
}
}
function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
{
// code for IE7+, Firefox, Chrome, Opera, Safari
return new XMLHttpRequest();
}
if (window.ActiveXObject)
{
// code for IE6, IE5
return new ActiveXObject("Microsoft.XMLHTTP");
}
return null;
}
i know php, mysql and html, but javascript is giving me heartburn.