Multiple List with PHP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ergocho
    New Member
    • Feb 2007
    • 2

    Multiple List with PHP

    Hello I need some help here...

    I have a dropdown list working perfect, but the problem is that I need it multiple selection, so when I change the name for name(), and the type for multiple posting with POST

    I thought it could be something like

    [PHP]echo"variable name[0]";
    echo"variable name[1]";[/PHP]


    does any of you know how to do it?
  • xwero
    New Member
    • Feb 2007
    • 99

    #2
    if i understand you have a list like
    [HTML]
    <select name="multiple[]" size="5">
    <option>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
    <option>5</option>
    </select>
    [/HTML]

    notice the [] in the name. This is the way to define an array for php

    [PHP]print_r(multipl e);[/PHP]

    If you do this when you post it form you will see an array with multiple values if you selected multiple options.

    i hope this is what you where looking for

    Comment

    • Motoma
      Recognized Expert Specialist
      • Jan 2007
      • 3236

      #3
      Thanks xwero!!

      Comment

      Working...