How to validate options in a dropdown in a PHP Codeigniter?


So i am Working on a project and here i have a dropdown in which i have certain values which change their color on certain changes.

Like the available values a colored as green and unavailable values are colored as red

So if i want to validate options in a dropdown and the user should be stopped from selecting the red values i.e. he won't be able to submit that value what should be done

Here is the code sample of my project.


public function get_teacher()  {   $room=$this->input->post('room_id');   $date=$this->input->post('exam_date');   $exam=$this->input->post('exam_id');   $response=$this->alo->get_teacher($date