I have to put an "onchange" event in database dropdown i.e when i select any element from database dropdown then corresponding table should be shown in dropdown menu,pLz help me i am in deep trouble.

See my code below:

i have two file.

(1) lib.php
(2)conn.php

See code of :lib.php" :-

/*
function : showlist fucntion is used for display the list
input : $abc = name of the drop down
$db_list = result set of the query
$value = value of the option
output : display string in the form of list (option)
*/
function showlistindrop($name_dp, $result_list, $value,$location)
{
//
$aa = "<SELECT NAME='$name_dp' onchange='pulldown_menu()'>";

//
while($row = mysql_fetch_row($result_list))
{

if ($value==$row[0])
$aa .= "<option value='".$location."' selected>".$row[0]."</option>";
else
$aa .= "<option value='".$location."' >".$row[0]."</option>";
}

//
$aa .= "</SELECT>";

//
return $aa;
}



See code of "conn.php" :-


<script language="javascript">
function pulldown_menu()
{
// Create a variable url to contain the value of the
// selected option from the the form named pulldown and variable selectname
var url = document.list.list_database.options[document.list.list_database.selectedIndex].value

// Re-direct the browser to the url value
window.location.href = url
}
</script>
<?

include("lib.php");

$connect=mysql_connect($_POST["host"],$_POST["user"],$_POST["pass"]) or die(mysql_error());

$db_list = mysql_list_dbs($connect);


print "<form method='post' name='list' >";

//
print showlistindrop("list_database", $db_list, $_POST['list_database']);
print "<br><INPUT TYPE=submit value='Save'>";
//


if ($_POST['list_database'])
{

$result = mysql_list_tables($_POST['list_database']);
print showlistindrop("list_table", $result, $_POST['list_table']);




}


I shall be very thankful to you.


Thanks

Parveen