making 2 dropdowns after select refresh

Discussion in 'Javascript' started by Wouter, Aug 27, 2005.

  1. Wouter

    Wouter Guest

    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
     
    Wouter, Aug 27, 2005
    #1
    1. Advertising

  2. Wouter

    Wouter Guest

    I have already fix the problem! The problem was mod_rewrite.

    Greets

    "Wouter" <laptop@_NOSPAM.com> schreef in bericht
    news:43106a4f$0$69741$...
    > 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
    >
     
    Wouter, Aug 27, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. KathyB
    Replies:
    6
    Views:
    582
    Todd Thompson
    Jun 27, 2003
  2. Jason Shohet
    Replies:
    1
    Views:
    354
    Jose L Rodriguez
    Dec 11, 2003
  3. rob merritt
    Replies:
    0
    Views:
    207
    rob merritt
    Mar 1, 2005
  4. palmiere
    Replies:
    1
    Views:
    453
    Erwin Moller
    Feb 9, 2004
  5. Replies:
    2
    Views:
    195
Loading...

Share This Page