Hai all, im new here so plz help me..im doing a php progrm so i try to passing the first jump menu to the second one on the same page..i tru using onchange but noting happen....both of the selction using data from sql data base..so plz help me
this is the code..
<?php session_start();
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="userdb"; // Database name
$tbl_name="logindb"; // Table name
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<link type="text/css" rel="stylesheet" href="/FileSystem/FS.css">
<style type="text/css">
<!--
.style4 {font-size: 24px}
-->
</style>
<script type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link type="text/css" rel="stylesheet" href="/FileSystem/FS.css">
<title>Msg</title>
</head>
<body bgcolor="#0066FF">
No Fail :
<?php
echo "<form method='get'> ";
$sqlfile = "SELECT * FROM filedb ;";
$result = mysql_query($sqlfile) or exit("QUERY FAILED!");
echo "<select name='menu2' onchange='MM_jumpMenu(parent,this,0)'>";
while ($rf=mysql_fetch_array($result)) {
echo "<option value='$rf[0]'>".$rf[0]."</option>";}
echo "</select></form>";
?><span class="style7">*</span>
<?php
$sql2 = "SELECT AttNO FROM attdb WHERE fileID= '".$_GET['menu2']."';";
$result2 = mysql_query($sql2) or exit("QUERY FAILED!");
echo "<select name='menu1' onchange='MM_jumpMenu(parent,this,0)'>";
while ($rt=mysql_fetch_array($result2)) {
echo "<option value='$rt[0]'>".$rt[0]."</option>";}
echo "</select>";
?><span class="style7">*</span>
</body>
</html>