I have a submit form with 3 fields. At least one of the field should be filled in before submitting. Could you please help me to do it with codeigniter form validation.
controller
$this->form_validation->set_rules('country', 'Country','trim|strip_tags');
$this->form_validation->set_rules('state','State','trim|strip_tags');
$this->form_validation->set_rules('city','City','trimstrip_tags');
Not a guru, but that will be my approach...
function do_add()
{
if( (isset($_POST['country']) || (isset($_POST['state']) || (isset($_POST['city']) )
{
//Do stuff
}
else
{
//Redirect or whatever
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With