multiple select option value validating in php

40

I have multiple select option value for online appointment form. My project is just like this project (Show a second dropdown based on previous dropdown selection)

I've on some jquery code to clear the option when user choose other option, the things is how I am going to validate the form, what I mean is at least one select option are selected at second level select option value.

I've tried using this code at validation php page

else if ($appointment_gc == " " 
         || $appointment_fu == " " 
         || $appointment_gas == " " 
         || $appointment_col == " " 
         || $appointment_ent == " " 
         || $appointment_ort == " " 
         || $appointment_ps == " " 
         || $appointment_package == " " ) {
            echo "Submission fails. You have not choose any package. 
                  Please go back and try again.
                  <input style=\"padding:10px 20px;margin-top:20px;\" 
                  type=button value=\"Back\" onClick=\"history.go(-1)\">"; 
          exit();
} 

each of$appointment_... are select option. I just want that at least one select option are selected, but seems that no matter how all failed to submit.

People are also looking for solutions to the problem: php - !empty() resulting true for value 0.0000

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.