hi
i'm new to ajax i've already got a drop down menu populated with values from my database and the code is underneath here, when i click on any province in the drop down menu the cities have to appear on the next page which are also from my database.The cities have to appear using a code from ajax i hear, i tried using a code from w3schools but doesn't seem to work at the moment.what i would like is a little bit of light on how i'm going to go about tackling this kinda problem.Just for clarity the drop down menu does work
[<html>]
[<head>][title]<?php echo $title;?>[/title]
[<h1>]<?php echo $heading;?>[</h1>]
[<script type="text/javascript">]
[</script>]
[</head>]
[<body>]
<?
function writeCities($id)
{
$con = mysql_connect("localhost","root","");
if (!$con) die('Could not connect: ' . mysql_error());
mysql_select_db("msansi", $con);
$query = "SELECT cities FROM provinces WHERE id =";
$query .= $id;
$result = mysql_query($query);
$row = mysql_fetch_array($result);
echo $row[0];
}
function populateDropBox()
{
$con = mysql_connect("localhost","root","");
if (!$con) die('Could not connect: ' . mysql_error());
mysql_select_db("msansi", $con);
$result = mysql_query("SELECT id,title,cities FROM provinces");
while($row = mysql_fetch_array($result))
{
echo "<option value=$row[0]>" . $row['title']."</option>";
}
}
?>
[<form name="myform">]
<select name = "province" onChange="onChangeDropBox();/">
<? populateDropBox(); ?>
<input type ="submit" value="submit";/>
</form>
[<script type="text/javascript">]
[</script>]
[</body>]