Submitting data from a multipick list form field

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Matt Phelps
Forum Commoner
Posts: 82
Joined: Fri Jun 14, 2002 2:05 pm

Submitting data from a multipick list form field

Post by Matt Phelps »

How do I do this? I want my user to be able to pick several things on a multipick list with either shift or control/click etc and then submit them. How do I get the information?

If the field name is 'listone' then if they only pick one item then that variable would be $listone but how about when they pick several items on the list?
fatalcure
Forum Contributor
Posts: 141
Joined: Thu Jul 04, 2002 12:57 pm
Contact:

Post by fatalcure »

one way is:

Code: Select all

<SELECT NAME='testfield&#1111;]' size='8' multiple>
     <OPTION value='1'>1
     <OPTION value='2'>2
     <OPTION value='3'>3
     <OPTION value='4'>4
</SELECT>
Then when trying to find out what fields were selected use:

Code: Select all

<?php
     foreach ($HTTP_GET_VARS&#1111;"testfield"] as $testfield) &#123; 
          echo "$testfield<br>";
     &#125;
?>
Post Reply