I have a select input field in multiple properties. I have to validate (empty check) this field in both JavaScript and PHP. My code is like:
select multiple="multiple" name="frm_supply[]>
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Let’s say you have an HTML code like this:
When submitting the form, if A, B and 1 are checked,
$_POSTarray will be like this:So, check trough a loop if any <select/> is empty. The following code walks through two <select/>s and displays for each either “List N has values” or “List N is empty”.
Now, to check selections on client side, proceed the same way and check what is selected in each <select/>.