Hi everyone,

I am new in PHP. I need PHP code to transfer items between two list boxes. The first listbox is populated from database and is multiselect. I need the selected items from first listbox being copied to the second listbox and then by submit, being inserted to the database.

Any help will be appreciated.
Mojgan

    Sounds like you want

    [listbox1]-------------[listbox2]
    |*item 1 |             |        |
    |*item 2 |    [-->]    |        |
    |*item 3 |             |        |
    |*item 4 |    [<--]    |        |
    |*item 5 |             |        |
    +--------+             +--------+
    
                         [submit]
    

    And by clicking the buttons in between you can move selected items from one side to the other.
    Then submit the list in [listbox2].

    You have PHP filling in [listbox1] when you first load the page, but you don't want it involved
    again until you submit.

    So JavaScript is going to have to do all the work. Moving to the Clientside forum.

      Thanks for your replies. I am looking for a solution exactly what Weedpacket has mentioned. I have some JS and PHP codes, but I do not know how to insert the values (id) from second list box to my database. still looking for some codes and samples. I will appreciate your kind cooperation.

        What I found was to make the second select box part of the form being submitted, and allow multiple selection (which it probably has already to make it easier to move stuff in and out). On submit, go through the second select box and mark all of its entries as selected. Then do the submit.

          Write a Reply...