Thanks for any help!
php code to push data to page:
Expand|Select|Wrap|Line Numbers
- <?php
- $q=$_GET["q"]; //number
- $blown = explode(',',$q);
- $q = $blown[0];
- $appl = $blown[1];
- include "/home/advent1/public_html/secure/connect.php";
- $clients= "'$_SESSION[group2]'";
- ?>
- <select name="lookupanswers">
- <option></option>
- <?php
- $i=1;
- while ($i <= '10') {
- $p="appl_quest{$i}_yn";
- $m="appl_drop_{$q}_{$i}";
- $n="quest{$i}_yn";
- $sqlappl = "SELECT appl from client_table where appl = {$blown[1]}";
- $resultappl = mysql_query($sqlappl) or die(mysql_error());
- $appl = mysql_result($resultappl, 0);
- $sqlapplquest = "select {$m} from lookup_table where appl = {$appl}";
- $resultapplquest = mysql_query($sqlapplquest) or die(mysql_error());
- $applquest = mysql_result($resultapplquest, 0);
- if ($applquest == '') {
- } else {
- ?>
- <option value="<?php echo $i; ?>"><?php echo $applquest; ?></option>
- <?php
- }
- $i++;
- }
- echo $sqlapplquest;
- ?>
Expand|Select|Wrap|Line Numbers
- var xmlhttp;
- function showUser(str,appl)
- {
- xmlhttp=GetXmlHttpObject();
- if (xmlhttp==null)
- {
- alert ("Browser does not support HTTP Request");
- return;
- }
- var url="getanswer.php";
- url=url+"?q="+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("txtAnswers").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;
- }
Expand|Select|Wrap|Line Numbers
- Question:
- <select name="lookups" onchange="showUser(this.value)">
- <option></option>
- <?php
- $i = '1';
- while ($i<'10') {
- $sqlapplquest = "select appl_drop_{$i} from appl_table where appl = {$appl}";
- $resultapplquest = mysql_query($sqlapplquest) or die(mysql_error());
- $applquest = mysql_result($resultapplquest, 0);
- if ($applquest != '') {
- ?>
- <option value="<?php echo $i; ?>,<?php echo $appl; ?>"> <?php echo $applquest; ?> </option>
- <?php
- }
- $i++;
- }
- ?>
- </select> Answered:<d id="txtAnswers"><select></select></d>