473,511 Members | 14,975 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

making 2 dropdowns after select refresh

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
1 2099
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1392
by: dominic | last post by:
Hallo miteinander, kann mir bitte jemand erklären warum ich mit diesem code keine dropdowns erzeugen kann: Gruppe A<br> <form name="form1"> <table> <?
2
4109
by: Phil Powell | last post by:
I have a form with two single-choice dropdowns. Upon doing an onChange event on either one of them, I want to check to see if the other dropdown has also been selected. How would I do that,...
0
903
by: Jeffrey | last post by:
Hi... I have several dropdowns located in a datagrid footer. Now say i modify the selection in dropdown1. I want to refresh the content of the other dropdowns with the result of a database...
3
1568
by: Damon | last post by:
I am working on a site in which I would like to have two dropdowns that will allow a user to navigate through the administrative pages of the site. The first would allow the user to choose the...
3
1543
by: Jon | last post by:
I am using cascading dropdowns, where one dropdown determines the data in the next, etc... If a dropdown has only one item in it, the SelectedIndexChanged event is never fired, even if you click...
1
1458
by: Andy | last post by:
What I want to do is to populate multiple dropdowns when editing. Presumably... a) I should use a DataReader so that I can get each ResultSet for each dropdown control, and that should cut down...
0
4638
by: nkparimi | last post by:
Hi, Here's what I'm trying: given an html table, to freeze the column headers and/or left column in IE. I understand that this is possible thru style sheets in IE, as suggested in the following:...
1
4010
by: Sunray | last post by:
I have a form called the sales form and i have 2 sets of listboxes So what happens is. i add items form the bottom set of list boxes which are bound to a data base to the top set of list boxes which...
4
4560
by: zion4ever | last post by:
Hello good people, Please bear with me as this is my first post and I am relative new to ASP. I do have VB6 experience. I have a form which enables users within our company to do an intranet...
0
7153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7371
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7432
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7093
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5676
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1583
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.