[linux] php a html

Ernest Beinrohr - OERNii oernii na chery2.axonpro.sk
Pátek Červenec 30 12:48:49 CEST 1999


http://sk.php.net/FAQ.php3

5.9 How do I get all the results from a SELECT MULTIPLE HTML tag? 
                          The SELECT MULTIPLE tag in an HTML construct allows
users to select multiple items from a list. These items are then passed to the
action
                          handler for the form. The problem is that they are all
passed with the same widget name. ie. 

                             <SELECT NAME="var" MULTIPLE>

                          Each selected option will arrive at the action handler
as: 

                             var=option1
                             var=option2
                             var=option3

                          Each option will overwrite the contents of the
previous $var variable. The solution is to use PHP's non-indexed array feature.
The following
                          should be used: 

                             <SELECT NAME="var[]" MULTIPLE>

                          This tells PHP to treat var as an array and each
assignment of a value to var[] adds an item to the array. The first item becomes
$var[0],
                          the next $var[1], etc. The count() function can be
used to determine how many options were selected, and the sort() function can be
used
                          to sort the option array if necessary.

                          Note that if you are using JavaScript the [] on the
element name might cause you problems when you try to refer to the element by
name.
                          Use it's numerical form element id instead. 

milan na soso.elas.sk wrote:
> 
> Mam jeden problem
> Nikde nemozem najst ako vytiahnut hodonty ak je oznacenych viac poloziek
> v php v takomto pripade
> 
> <FORM>
> <TD width="80">&nbsp;Komu:</TD>
> <TD><SELECT NAME="komu" SIZE="2" MULTIPLE>
> <OPTION VALUE="5">  Jano Benadik
> <OPTION VALUE="2">  Juraj Capliar
> <OPTION VALUE="1">  Milan Hromada
> <OPTION VALUE="3">  Roman Sliva
> </SELECT></TD>
> </FORM>

-- 
          @@@@@@   @@@@@@@@  @@@@@@@   @@@  @@@  @@@  @@@
         @@!  @@@  @@!       @@!  @@@  @@!@!@@@  @@@  @@@
         !@!  !!!  !!!!!:    !!@!@!    !@!  !!!  !!!  !!!
         :!:  !:!  :!:       :!:  !:!  :!:  !:!  :!:  :!:
          : :  :   : :: ::    :   : :  ::    :   :    :
         ==============----------------------------------
         OERNii - Ernest Beinrohr
         mailto:oernii na oernii.sk
         http://www.oernii.sk
         #holubnik on IRCNET
         ICQ No : 28153343



Další informace o konferenci linux