Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Apr 2004
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    drop down menu action help

    How do i make dropdown menus do something?? I am making a imagr gallery which shows one image at a atime out of a estimate of 15, i would like a drop down menu which changes the picture when you select something from it , I would like it to goto a certain site!!! in this case pictures.php?image=002 or something like that... can you help ??
    ...not bad for a thirteen year old

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,081
    Thanks
    11
    Thanked 99 Times in 97 Posts
    if your dropdown is part of a form you probably want to change the action of the form to the selected dropdown url .. thats a javascript thing so moving you there

    [unless you have your form goto another PHP page which then redirects via the selected form DD value

    form_action.php (where goto is the name of your <select> field)

    PHP Code:
    <?
    if( !empty( $_REQUEST['goto'] ) ){
       
    header"location:{$_REQUEST['goto']}" );
       exit();
    }
    die(
    'error');
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #3
    New Coder
    Join Date
    Apr 2004
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts
    what bout my option field
    ...not bad for a thirteen year old

  • #4
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,081
    Thanks
    11
    Thanked 99 Times in 97 Posts
    Code:
    <form id="bella" action="form_action.php" method="POST">
    <select name="goto">
    <option value="http://www.php.net">php.net</option>
    <option value="http://www.apache.org">apache</option>
    </select>
    </form>
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #5
    New Coder
    Join Date
    Apr 2004
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <form action="gallery.php" method="get">
    <select name="image">
    
    <option value="1"></option>
    </select>
    <input type="submit" value="go">
    </form>
    Can you tell me.... why i get the result image=+1
    that ok apart from the + bit
    can that disappear?
    ...not bad for a thirteen year old


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •