Checking for specific domain in email address? |
[eluser]Wonder Woman[/eluser]
Hi, I'm trying to check if a user is registering with the correct email address, it must be of a specific domain... for example [email protected] I found a script on the web and tried changing it with no luck, can you help me please? Code: function _valid_domain($str) Code: $this->form_validation->set_rules('email', 'Email address', 'trim|required|xss_clean|valid_email|callback__valid_domain');
[eluser]Glazz[/eluser]
Something like: Code: $email = "[email protected]";
[eluser]Wonder Woman[/eluser]
Yes that would work but I want it on a callback function and it just isn't working Code: $this->form_validation->set_rules('email', 'Email address', 'trim|required|xss_clean|valid_email|callback_valid_domain');
[eluser]Glazz[/eluser]
Is your callback function getting called ? Try placing an echo inside the function and see if it shows up, if not, the callback is not working. Edit: Your function needs to look something like: Code: function _valid_domain($email)
[eluser]Wonder Woman[/eluser]
I have fixed it thanks, didn't realise it had to be in the same Controller. Thanks
|
Welcome Guest, Not a member yet? Register Sign In |