SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot
    Join Date
    May 2001
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Pulldown form menus and PHP variables

    Hi All,

    I have two questions for you, although if you aren't able to answer the first one you may not be able to answer the second one either.
    Do any of you know how to make a pulldown form menu where you are able to choose more than one of the options by holding down CTRL and clicking? I have seen them before, but have never seen the code for one of them. Secondly, how would one go about passing the selections to PHP to store in variables for other operations? Would it be the same way as with checkmarked box inputs?

    Cheers,

    XGuy

  2. #2
    SitePoint Wizard
    Join Date
    Sep 1999
    Posts
    1,390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not sure how to do the PHP, but here is your HTML:
    Code:
    <form action="http://www.domain.com/" method="post">
    <select name="NAME" size="3" multiple>
    	<option value="[VALUE]"> [VALUE]</option>
    	<option value="[VALUE]"> [VALUE]</option>
    	<option value="[VALUE]"> [VALUE]</option>
    	<option value="[VALUE]"> [VALUE]</option>
    	<option value="[VALUE]"> [VALUE]</option>
    	<option value="[VALUE]"> [VALUE]</option>
    	<option value="[VALUE]"> [VALUE]</option>
    
    </select>
    
    </form>
    You'll want to change the size="" attribute to the number of lines you want displayed. Make sure you set method="post" to what you want, and change the domain. the "multiple" attribute of <select> is the key to multiple selections.

    Hope this helps.

    EDIT: Also make sure to change [VALUE] to what you want displayed

  3. #3
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Aidan,

    Don't forget to make the name of the select an array, so the whole array will get passed like

    Code:
    <select name="NAME[]" size="3" multiple>
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  4. #4
    SitePoint Wizard
    Join Date
    Sep 1999
    Posts
    1,390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for pointing that out. As you can see I have a long while to go with PHP

  5. #5
    Node mutilating coot timnz's Avatar
    Join Date
    Feb 2001
    Location
    New Zealand
    Posts
    516
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And in answer to your second question, yes. In an array like freddydoesphp demonstrated.

  6. #6
    SitePoint Zealot
    Join Date
    May 2001
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the help everyone! I'm sure I'll have more questions soon.

    -XGuy.


Bookmarks

Posting Permissions

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