making 2 dropdowns after select refresh

W

Wouter

Hi,

I would like to make a dropdown menu. When a user select something i want to
use his selection in PHP for a next dropdown menu. When the user has
selected something in the second dropdown menu i know then what i most show
for data.

If have make one drop down menu but i dont know how i can use the selection
in PHP. I think i'm using the wrong javascript. But i dont know what i
need....

I have the follow code:

<?php
$db = mysql_connect ($dbhost_hostel, $dbuser_hostel, $dbpasswd_hostel) or
die ("Verbindeing mislukt");
mysql_select_db($dbname_hostel, $db);
$query = "SELECT DISTINCT(land) FROM hostel WHERE validate='1'";
$res = mysql_query($query);
$hostel = mysql_fetch_array($res);
?>

<SCRIPT type="text/javascript" LANGUAGE="JavaScript">
<!--
var d = document;
d.write("<form name='goLand'>");
d.write("<select name='goland' size=1 class=input
onchange='window.location=d.goLand.goland.options[d.goLand.goland.selectedIndex].value'>");
d.write("<option value='#' selectED>Menu");
<?php while($hostel = mysql_fetch_array($res)){ ?>
d.write("<option value='<?php echo $hostel['land'];?>'><?php echo
$hostel['land'];?>");
<?php } ?>
d.write("<\/select>");
d.write("<\/form>");
//-->
</script>

<?php } ?>

For exemple: http://www.backpack.nu/content/verblijf/verblijf/0/ (below)

Can someone help how i can make this ?
Greets Wouter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top