[JQuery] Problem with serialize and $.ajax

Hello

I have a form with a multiple select list. I’m serializing this form using $(“form”).serialize();, then I’m passing this data using $.ajax() function in the data parameter to a PHP file.

All data is being passed correctly except that of the multiple list, where one selection of the multiple list is being sent not all.

I have used alert() to see how the serialized form data look like, and found that up to that level all data exists, for instance i can see all the multiple select data (multiple=1&multiple=2&multiple=3…)

How to pass all these data not only one?

Thank you

How are you confirming that only one is being passed?

Have you checked what the retrieved data from the php side looks like, with print_r for example?

Yes I used print_r()
I got for example

[multiple] => 3

You may need then to provide code examples for how the data is being sent

var datastring = $("form[id='myform']").serialize();
$.ajax({method: "post",
        url: "myfile.php",
        data: datastring,
        success: function(result) { 
            alert(result);
        }
});

And from the php side? How are the values being retrieved

The following might help
http://nz.php.net/manual/en/faq.html.php#faq.html.select-multiple

where you use “multiple” instead of “multiple” for the select name.

In the PHP i simply


print_r($_POST);

I will check the link and revert, thank you.

[quote]The following might help
http://nz.php.net/manual/en/faq.html...elect-multiple

where you use “multiple” instead of “multiple” for the select name.
I will check the link and revert, thank you.[/quote]
Thank you, works perfectly.