CodeIgniter Forums
can i set 2 rules in email validation ? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: can i set 2 rules in email validation ? (/showthread.php?tid=29008)



can i set 2 rules in email validation ? - El Forum - 03-27-2010

[eluser]johansonevR[/eluser]
hi there,
i am clear with email validation, can i insert one more rule, for example something like the following code ?
Code:
$rules=array(
'field'=>'email',
'label'=>'E-mail',
'rules'=>'required'
'rules'=>'valid_email'
);
it doesn't work this way but i hope you get the idea Smile
so how to build the rules to accept two 'rules' ->one for 'required', other for 'valid_email' ?
tnx.


can i set 2 rules in email validation ? - El Forum - 03-27-2010

[eluser]cahva[/eluser]
To get more rules applied, just add them with pipe character:
Code:
$rules = array(
    array(
        'field' => 'email',
        'label' => 'E-mail',
        'rules' => 'required|valid_email'
    )
);



can i set 2 rules in email validation ? - El Forum - 03-27-2010

[eluser]johansonevR[/eluser]
tnx