Skip to content Skip to sidebar Skip to footer

How Can I Get All Options In A Multi-options Select Using Php?

I am using 2 select menus where one have value and the other one is empty and when a user select items from the left and click a bitton the selected items are moved to the right me

Solution 1:

Just move the JavaScript code in your question to the submit callback of your form.

$("form:has(#lstBox2)").on('submit', function () {
    $("#lstBox2 option").prop('selected', true);
});

Solution 2:

You can send the information of selected options in JSON format, and in server-side, you can easily use PHP json_decode() to parse the information.

Post a Comment for "How Can I Get All Options In A Multi-options Select Using Php?"