[eluser]boltsabre[/eluser]
Easiest way is just not to give your <option> a value, there is no reason to!
Code:
<option value=""> Please Select</option>
And then your "required" rule will fail if they don't select something else. That easy!
On a side note, with regards to security and data cleansing, I'd make the value for Yes = 1, No = 0, and then use this rule set - it will stop people from tampering with your post data (which there are now "out of the box" hacking programs, plugins, etc that people can and do use) and only return what you want.
Code:
$this->form_validation->set_rules('','','trim|required|is_natural|less_than[2]');
With this validation it will only ever validate if user submits a 0 or a 1... just using "required" is not good enough. I expect somewhere in your model or controller you run something like
Code:
if($hosting == "yes"){
//do something
}else{
// then it MUST be "no", so lets do something else
}
Well if the user is malicious and have submitted "im a hacker" then your above code will default to your else statement. Best case scenario is you get an "no" value in your database, worse case, depending on your application, is security/exploit holes or causing a fatal error and crashing that page.