PHP+Javascript - Move items from 1 multiple select to another, then process second

Discussion in 'PHP' started by dtang4, Nov 2, 2006.

  1. #1
    Hey all,
    I would like to have a 2 multiple select field setup, where items in the first select can be moved to the other select (like so: http://www.johnwbartlett.com/CF_tipsNtricks/index.cfm?TopicID=86)

    Then, after the form is submitted, I want to process all the items in the 2nd multiple select field.

    How do I do this?

    If my question is unclear, please let me know. Thanks.
     
    dtang4, Nov 2, 2006 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Well you've got the Javascript code there. You only have to change the name from the second select to this.
    
    name="FeatureCodes[]"
    
    Code (markup):

    Now you can receive and process it as array.

    
    print_r($_POST['FeatureCodes']);
    
    PHP:
     
    nico_swd, Nov 2, 2006 IP
  3. dtang4

    dtang4 Active Member

    Messages:
    303
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #3
    If I add the brackets, my javascript stops working. I think brackets aren't legal characters for field names in js.
     
    dtang4, Nov 2, 2006 IP
  4. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #4
    Ahh yes, I see. Someone had the same problem here.
    programmingtalk.com/showthread.php?t=31794

    It might help.
     
    nico_swd, Nov 3, 2006 IP
  5. dtang4

    dtang4 Active Member

    Messages:
    303
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #5
    This is a very belated thank you. (I haven't had a chance to look at this problem since.)

    I think that thread just may have what I've been looking for!
     
    dtang4, Jan 21, 2007 IP