Email validation |
[eluser]yorvik[/eluser]
Hello, CI uses this for the form_validation of emails: Code: return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE; But when I want to add this emailadres: [email protected], I always get an error of not valid email. How can I fix this. Thanks in advance
[eluser]Cristian Gilè[/eluser]
It works for me. Please, provide your code. Cristian Gilè
[eluser]yorvik[/eluser]
Code: <?php I think it has something to do with this: $email = mysql_real_escape_string($_POST['signup-email']);
[eluser]Atharva[/eluser]
First, run the regex and then use Code: mysql_real_escape_string() In fact, why you are not using CI's inbuilt class Code: if(!preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $email)){
[eluser]yorvik[/eluser]
OK thank you no I am not inserting the post value. I was testing this when I realised I don't need to use mysql_real_escape_string. Thanks anyway:p |
Welcome Guest, Not a member yet? Register Sign In |