List Box Help

Discussion in 'C#' started by bjlaw1979, Jun 23, 2007.

  1. #1
    am tryin to put a multiple selection box in ma page. wat i need to do is allow the user to make multple selections and then grap these selections to the database..
    1.which box shud i use for this..listbox?
    2.the user shud be able to make more than one selection..these selections shud be saved in a database on completion of form submit.
    hopin to solve this prblm at the earliest.
    cheers
     
    bjlaw1979, Jun 23, 2007 IP
  2. pinkstor

    pinkstor Active Member

    Messages:
    93
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    75
    #2
    1. It depends on what you mean, exactly. If you want a field of checkboxes, then use checkboxes. If you want pulldown menus with multiple choices, use select boxes with a "multiple" option like so:

    <select name="colors[]" multiple="multiple">

    2. Either way, you'll need to parse through the array of results to get the data you want. Something like:

    foreach ($colors as $c){
    echo $c; //do something with $c
    }

    Cool?
     
    pinkstor, Jun 23, 2007 IP
  3. bjlaw1979

    bjlaw1979 Guest

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanx buddy..
    the list box with "multiple" option served the purpose...
     
    bjlaw1979, Jun 24, 2007 IP