Hi,
I am using a code for chained select box. Its doing great in IE9, IE10, chrome, FF.
first select box is coming up based on that second is not displaying for IE6, IE7,IE8. Please let me know how to identify the issue.
Following is the code:
<?php
/**************************************
Page load dropdown results
**************************************/
function getTierOne()
{
$result = mysql_query("select distinct cmp_city from company where status='active' order by cmp_city")
or die(mysql_error());
while($tier = mysql_fetch_array( $result ))
{
echo '<option value='.$tier['cmp_city'].'>'.$tier['cmp_city'].'</option>';
}
}
/**************************************
First selection results
**************************************/
if(isset($_GET[‘func’])&& $_GET[‘func’] == ‘drop_1’ ) {
drop_1($_GET[‘drop_var’]);
}
function drop_1($drop_var)
{
echo “<script type=\“text/javascript\”>
$(document).ready(function() {
$(‘#wait_2’).hide();
$(‘#drop_2’).change(function(){
$(‘#wait_2’).show();
$(‘#result_2’).hide();
$.get(\“func.php\”, {
func: \“drop_2\”,
drop_var: $(‘#drop_2’).val()
}, function(response){
$(‘#result_2’).fadeOut();
setTimeout(\“finishAjax_tier_three(‘result_2’, '\”+escape(response)+\”')\", 400);
});
return false;
});
});
function finishAjax_tier_three(id, response) {
$(‘#wait_2’).hide();
$(‘#’+id).html(unescape(response));
$(‘#’+id).fadeIn();
}
</script>";
$result = mysql_query(“SELECT DISTINCT cmp_name,cmp_branch FROM company WHERE cmp_city=‘$drop_var’ AND user_type = ‘3’ order by cmp_branch”) or die(mysql_error());
echo ‘<select name = “userid” id = “drop_2” class = “required”>
<option value = " “> Choose Agent </option> ‘;
while($drop_2 = mysql_fetch_array( $result )) {
echo ‘<option value = "’.$drop_2[‘cmp_name’].’”>’.$drop_2[‘cmp_branch’].’ - ‘.$drop_2[‘cmp_name’].’</option>';
}
echo ‘</select></td>’;
}
/**************************************
Second selection results
**************************************/
if(isset($_GET[‘func’])&& $_GET[‘func’] == ‘drop_2’ ) {
drop_2($_GET[‘drop_var’]);
}
function drop_2($drop_var)
{
$result = mysql_query("SELECT * FROM company where cmp_name = '$drop_var'") or die(mysql_error());
while($drop_3 = mysql_fetch_array( $result )) {
echo '</td></tr><td colspan = "3">Telephone : <input type = "text" name = "userTelephone" value = "'.$drop_3['cmp_phone'].'" readonly = readonly class = "required"</td>';
echo '<td colspan = "3"> Address : <textarea rows = "2" cols = "60" name = "userAddress" readonly = readonly class = "required" > '.$drop_3['cmp_address'].' </textarea> </td></tr>';
break;
}
}