Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IE7 Select Values From Drop Down Issue

Status
Not open for further replies.

TunerRevolution

IS-IT--Management
Aug 29, 2008
4
US
Hello All. On a new project my company paid to have some code written. Below is what we were given. This code is basically a Year Make Model type, the user will select the options and be displayed a result from the database.

The code works great in IE8, FF, and Opera however IE7 returns the result "Select All Values" as if something isnt being passed through for submit. The person who did this is now gone, and though im a graphic designer, its been put on me since "I know computers"

Any help would be greatly appreciated!

---------------------------------------------

<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html xmlns="<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Main Page</title>
<script language="javascript">

//------------------------
function loadMake(region)
{
loadField="<select name=\"Make\" id=\"selMake\" onchange=\"loadModel(mainForm.Region.value, mainForm.Make.value);\"><option value=\"\">Select Make</option>";
if(region=="USA")
{
<?php
$sql="SELECT DISTINCT Make FROM cars
WHERE USAModel!=''";
$result=mysql_query($sql);
if(mysql_num_rows($result)!=0)
{
while($row = mysql_fetch_array($result))
{
?>
loadField=loadField+"<option value=\"<?php echo $row["Make"]; ?>\"><?php echo $row["Make"]; ?></option>";
<?php }
}
?>
}
if(region=="Euro")
{
<?php
$sql="SELECT DISTINCT Make FROM cars
WHERE EuroModel!=''";
$result=mysql_query($sql);
if(mysql_num_rows($result)!=0)
{
while($row = mysql_fetch_array($result))
{
?>
loadField=loadField+"<option value=\"<?php echo $row["Make"]; ?>\"><?php echo $row["Make"]; ?></option>";
<?php }
}
?>
}
if(region=="Mexico")
{
<?php
$sql="SELECT DISTINCT Make FROM cars
WHERE MexicoModel!=''";
$result=mysql_query($sql);
if(mysql_num_rows($result)!=0)
{
while($row = mysql_fetch_array($result))
{
?>
loadField=loadField+"<option value=\"<?php echo $row["Make"]; ?>\"><?php echo $row["Make"]; ?></option>";
<?php }
}
?>
}
if(region=="AsiAust")
{
<?php
$sql="SELECT DISTINCT Make FROM cars
WHERE AsiAustModel!=''";
$result=mysql_query($sql);
if(mysql_num_rows($result)!=0)
{
while($row = mysql_fetch_array($result))
{
?>
loadField=loadField+"<option value=\"<?php echo $row["Make"]; ?>\"><?php echo $row["Make"]; ?></option>";
<?php }
}
?>
}
loadField=loadField+"</select>";
document.getElementById("Make").innerHTML=loadField;
}

function loadModel(region, make)
{
var loadField=new Array();
if(region=="USA")
{
<?php $sql="SELECT DISTINCT Make FROM cars
WHERE USAModel!=''";
$mk_result=mysql_query($sql);
if(mysql_num_rows($mk_result)!=0)
{
while($mk_row = mysql_fetch_array($mk_result))
{
?>
loadField["<?php echo $mk_row["Make"]; ?>"]="<select name=\"Model\" id=\"selModel\" onchange=\"showInfo(mainForm.Region.value, mainForm.Make.value, mainForm.Model.value, \'\');\"><option value=\"\">Select Model</option>";
<?php
$sql="SELECT DISTINCT USAModel FROM cars
WHERE USAModel!=''
AND Make='".$mk_row["Make"]."'";
$result=mysql_query($sql);
if(mysql_num_rows($result)!=0)
{
while($row = mysql_fetch_array($result))
{
?>
loadField["<?php echo $mk_row["Make"]; ?>"]=loadField["<?php echo $mk_row["Make"]; ?>"]+"<option value=\"<?php echo $row["USAModel"]; ?>\"><?php echo $row["USAModel"]; ?></option>";
<?php }
}?>
loadField["<?php echo $mk_row["Make"]; ?>"]=loadField["<?php echo $mk_row["Make"]; ?>"]+"</select>";
<?php }
}
?>
document.getElementById("Model").innerHTML=loadField[make];
return;
}
if(region=="Euro")
{
<?php $sql="SELECT DISTINCT Make FROM cars
WHERE EuroModel!=''";
$mk_result=mysql_query($sql);
if(mysql_num_rows($mk_result)!=0)
{
while($mk_row = mysql_fetch_array($mk_result))
{
?>
loadField["<?php echo $mk_row["Make"]; ?>"]="<select name=\"Model\" id=\"selModel\" onchange=\"showInfo(mainForm.Region.value, mainForm.Make.value, mainForm.Model.value, \'\');\"><option value=\"\">Select Model</option>";
<?php
$sql="SELECT DISTINCT EuroModel FROM cars
WHERE EuroModel!=''
AND Make='".$mk_row["Make"]."'";
$result=mysql_query($sql);
if(mysql_num_rows($result)!=0)
{
while($row = mysql_fetch_array($result))
{
?>
loadField["<?php echo $mk_row["Make"]; ?>"]=loadField["<?php echo $mk_row["Make"]; ?>"]+"<option value=\"<?php echo $row["EuroModel"]; ?>\"><?php echo $row["EuroModel"]; ?></option>";
<?php }
}?>
loadField["<?php echo $mk_row["Make"]; ?>"]=loadField["<?php echo $mk_row["Make"]; ?>"]+"</select>";
<?php }
}
?>
document.getElementById("Model").innerHTML=loadField[make];
return;
}
if(region=="Mexico")
{
<?php $sql="SELECT DISTINCT Make FROM cars
WHERE MexicoModel!=''";
$mk_result=mysql_query($sql);
if(mysql_num_rows($mk_result)!=0)
{
while($mk_row = mysql_fetch_array($mk_result))
{
?>
loadField["<?php echo $mk_row["Make"]; ?>"]="<select name=\"Model\" id=\"selModel\" onchange=\"showInfo(mainForm.Region.value, mainForm.Make.value, mainForm.Model.value, \'\');\"><option value=\"\">Select Model</option>";
<?php
$sql="SELECT DISTINCT MexicoModel FROM cars
WHERE MexicoModel!=''
AND Make='".$mk_row["Make"]."'";
$result=mysql_query($sql);
if(mysql_num_rows($result)!=0)
{
while($row = mysql_fetch_array($result))
{
?>
loadField["<?php echo $mk_row["Make"]; ?>"]=loadField["<?php echo $mk_row["Make"]; ?>"]+"<option value=\"<?php echo $row["MexicoModel"]; ?>\"><?php echo $row["MexicoModel"]; ?></option>";
<?php }
}?>
loadField["<?php echo $mk_row["Make"]; ?>"]=loadField["<?php echo $mk_row["Make"]; ?>"]+"</select>";
<?php }
}
?>
document.getElementById("Model").innerHTML=loadField[make];
return;
}
if(region=="AsiAust")
{
<?php $sql="SELECT DISTINCT Make FROM cars
WHERE AsiAustModel!=''";
$mk_result=mysql_query($sql);
if(mysql_num_rows($mk_result)!=0)
{
while($mk_row = mysql_fetch_array($mk_result))
{
?>
loadField["<?php echo $mk_row["Make"]; ?>"]="<select name=\"Model\" id=\"selModel\" onchange=\"showInfo(mainForm.Region.value, mainForm.Make.value, mainForm.Model.value, \'\');\"><option value=\"\">Select Model</option>";
<?php
$sql="SELECT DISTINCT AsiAustModel FROM cars
WHERE AsiAustModel!=''
AND Make='".$mk_row["Make"]."'";
$result=mysql_query($sql);
if(mysql_num_rows($result)!=0)
{
while($row = mysql_fetch_array($result))
{
?>
loadField["<?php echo $mk_row["Make"]; ?>"]=loadField["<?php echo $mk_row["Make"]; ?>"]+"<option value=\"<?php echo $row["AsiAustModel"]; ?>\"><?php echo $row["AsiAustModel"]; ?></option>";
<?php }
}?>
loadField["<?php echo $mk_row["Make"]; ?>"]=loadField["<?php echo $mk_row["Make"]; ?>"]+"</select>";
<?php }
}
?>
document.getElementById("Model").innerHTML=loadField[make];
return;
}
}
//------------------------

function showInfo(region, make, model, year)
{
if (window.XMLHttpRequest)
{// code for IE7+ Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5,
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
var queryString='';
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
if(year=="")
{
document.getElementById("Year").innerHTML=
"<select name=\"Year\" id=\"selYear\">"
+"<option selected value=\"\">Select Year</option>"
+xmlhttp.responseText+"</select>";
}
}
}
if(year=="")
queryString="dbFetch3.php?param=" + region + "~" + make + "~" + model.replace("&","%26") ;
xmlhttp.open("GET",queryString,true);
xmlhttp.send();
}

function chkBlank(region, make, model, year)
{
if(year=="")
year=document.getElementById("selYear").options[document.getElementById("selYear").selectedIndex].value;
if(region=="" || make=="" || model=="" || year=="")
{
alert("Please select all values");
}
else
{
document.getElementById("mainForm").submit();
}
}
</script>
<script type="text/javascript" src="/~spcalign/specprod/administrator/plugins/system/rokbox/rokbox.js"></script>

<body><center>
<strong><h2><u>Application Search</h2></strong></u>Select your region, make, model and year to display applications</center><br>
<div id="formContainer">
<form name="mainForm" id="mainForm" action="index.php?option=com_ktnpro&task=details" method="POST">
<table width="626">
<tr>
<td width="10"> </td>
<td width="604"><div id="Region">
<select name="Region" id="selRegion" onchange="loadMake(mainForm.Region.value);">
<option value="">Select Region</option>
<option value="USA">USA/North America</option>
<option value="Euro">Europe</option>
<option value="Mexico">Mexico/Latin America</option>
<option value="AsiAust">Asia/Australia</option>
</select></div>
</td>
</tr>
<tr>
<td> </td>
<td><div id="Make">
<select name="Make" id="selMake" onchange="showInfo(mainForm.Region.value, mainForm.Make.value, '', '');">
<option value="">Select Make</option>
</select></div></td>
</tr>
<tr>
<td> </td>
<td><div id="Model">
<select name="Model" id="selModel" onchange="showInfo(mainForm.Region.value, mainForm.Make.value, mainForm.Model.value, '');">
<option value="">Select Model</option>
</select></div></td>
</tr>
<tr>
<td> </td>
<td><div id="Year">
<select name="Year" id="selYear" onchange="">
<option value="">Select Year</option>
</select></div>
</td>
</tr>
</table>
<div id="Submit"><input type="button" value="Submit" onclick="chkBlank(mainForm.Region.value, mainForm.Make.value, mainForm.Model.value,

mainForm.Year.value);"/></div>
<!--<div id="Submit"><input type="button" value="Submit" onclick="mainForm.submit();"/></div>-->
</form></div>
</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top