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>]

Kgizo,

"next page" and "ajax" are mutually exclusive. It's either one or the other.

Which do you want?

Airshow

ok thanxx i know that now airshow i've created a new window using the window.open method in javascript now all i need to do is fetch information from my database and display the cities as soon as you click on the submit button when a province is chosen from my drop menu.
thanxx in advance.

Kgizo,

Creating a new window doesn't address the point I was making.

Do you want :

  1. to use AJAX to obtain the data from the database and display it on the same page without refreshing the page (that's what AJAX does).
  2. to serve a new page (in to the same window or an opened window) to display the data.

Your original post is ambiguous in this regard.

Airshow

thanxx airshow i managed to solve my problem using php i used a form to move from 1 page to another with the action method then i posted my provinces. i also managed to get my data from my database and display it on different pages. thannx for your interest!!!!!