I'm using select element with multiple selections and image field for my Ajax form. For submitting image, I've to use form enctype="multipart/form-data". When I submit the form, the post data for my multiple select element named "business_type" is as follow since I select three options from select element.
Content-Disposition: form-data; name="business_type"
Manufacturer
-----------------------------212041485118126
Content-Disposition: form-data; name="business_type"
Wholesaler
-----------------------------212041485118126
Content-Disposition: form-data; name="business_type"
Trading House
Now, in my $_REQUEST array (In PHP), I'm receiving only the last item as it is obvious from above-mentioned post data. How can I get the other selected values?
Just a simple trick that worked for me is by replacing the select element name
name="business_type"with an array as follow.Replace
with
So getting the array of all selected fields in post data.