i want to create list load from db countries and then full second list from db when condition true.
code run in opera successfully but in IE Not run...
I'm beginner and using Smarty Templates.
first code country.tpl
second show_country.php
third country.js
<html>
<head>
<script type="text/javascript" src="css/country.js"></script>
</head>
<body>
<table align="center">
<tr align="center"><td><b><h3><ul>Country List yousing AJAX</ul></h3></b></td></tr>
</table><br>
<table align="center">
<!-- Form1 to show all countries in database using section loop and using function ShowCity() -->
<form action="" method="" name="frm1" >
<font color="#FF0000"><b>Choose Your Country:</b></font><br>
<select name="slccountry" onChange="ShowCity()">
{section loop=$arrcountry name=index}
<option value="{$arrcountry[index].id}">{$arrcountry[index].country}</option>
{/section}
</select>
</form>
<!-- Form2 Recived Result from Form1 using id slccity-->
<form name="frm2">
<br><font color="#FF0000"><b>Choose your city</b></font><br />
<select name="slccity" id="slccity"></select>
</form>
</table><br/><br/><br><br>
<table align="center">
<a href="show_customers.php" class="link"><h3> Show Customers </h3></a>
</table>
</body>
</html>
----------------------------------------------------------------------------
<?
include('header.php');
$id = intval($_GET['id']);
//$smarty->assign('id',$id);
require_once('modules/modloadcountry.php');
$arrcountry = loadcountries($id,false);
$smarty->assign('arrcountry',$arrcountry);
/* Smarty Class But Using looping
$sql = "select * from cities where id = ".$id;
$result = $db->Execute($sql);
$id = $result->fields['id'];
$city = $result->fields['city'];
$smarty->assign('id',$id);
$smarty->assign('city',$city);
echo "<option value=''>{$city}</option>";
*/
//Normal PHP
$link = mysql_connect("localhost","root","");
$db = mysql_select_db("entelaq",$link);
$sql = "SELECT * FROM cities WHERE id= $id";
$result = mysql_query($sql);
while ( $row = mysql_fetch_array($result) )
{
echo "<option value=$row[id]>{$row[city]}</option>";
}
//echo "<th>".$sql."</th>";
//echo "<th>".$result."</th>";
$smarty->display('country.tpl');
include('footer.php');
?>
------------------------------------------------------------------------
var xmlHttp = new XMLHttpRequest(); // Declaration Object
function ShowCity()
{
xmlHttp.open('get','show_country.php?id='+document.frm1.slccountry.selectedIndex); // Send Request
xmlHttp.onreadystatechange = handleInfo;
xmlHttp.send(null); // End Request
}
function handleInfo()
{
if(xmlHttp.readyState == 1)
{
document.getElementById('slccountry').innerHTML = 'loading ..';
}
else if(xmlHttp.readyState == 4)
{
var response = xmlHttp.responseText; // Server Answer
document.getElementById('slccity').innerHTML = response; // print to Menu
}
}