By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,504 Members | 1,170 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,504 IT Pros & Developers. It's quick & easy.

making 2 dropdowns after select refresh

P: n/a
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
Aug 27 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
I have already fix the problem! The problem was mod_rewrite.

Greets

"Wouter" <laptop@_NOSPAM.com> schreef in bericht
news:43***********************@news.wanadoo.nl...
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

Aug 27 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.