I have a form with a drop down list that is being populated by the user using java script. I would like to retrieve (on server side) all options of this drop down list on submit. I mean to all of them, not only the ones that have been selected, since they are not being signed as "selected". Is there a way of doing it by php code? I don't want to use a java script solution.
Thank you
The unselected options in a <select>
element are not sent to the server by the web browser, so you have no way to get these with PHP. You will have to use JavaScript.
You mention that the list is being populated by JavaScript in the first place, perhaps you could modify that JavaScript to also stick the values in a hidden form field up front, so that they are available server-side when the form is submitted.
Otherwise you would need to create an onsubmit
handler to get all the options using Javascript, and then possibly store them in a hidden form field.
The browser won't send the unselected options to the server, so: No