![]() |
Problem with valid_email return true for invalid email address - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Problem with valid_email return true for invalid email address (/showthread.php?tid=70276) |
Problem with valid_email return true for invalid email address - zjonsnowz - 03-17-2018 Hello, I'm new to CI and just setup and working on the sign up form, but some how the valid_email rule in form validation is not working. I have tried the function valid_email() too and it's still not working. How come this email "a!b#c$e%g^h&j*[email protected]" can pass the validation? PHP Code: <?php This code is displaying "valid email". Did I miss something? Please help. RE: Problem with valid_email return true for invalid email address - jreklund - 03-17-2018 Because it's valid (and don't know that gmail have restrictions): https://en.wikipedia.org/wiki/Email_address#Examples RE: Problem with valid_email return true for invalid email address - zjonsnowz - 03-17-2018 So if I want to reject that email, then I guess I have to create my own rules. Thanks jreklund. RE: Problem with valid_email return true for invalid email address - InsiteFX - 03-18-2018 You should be using the PHP Filters. PHP Code: $email = "[email protected]"; RE: Problem with valid_email return true for invalid email address - jreklund - 03-18-2018 (03-17-2018, 03:16 PM)zjonsnowz Wrote: So if I want to reject that email, then I guess I have to create my own rules. That's correct. According to the standard it's valid, but I haven't seen any human include those signs... So you can also check for symbols and deny those e-email addresses. @InsiteFX: That's exactly what that function does. RE: Problem with valid_email return true for invalid email address - pooja7r - 03-23-2018 if (filter_var($email, FILTER_VALIDATE_EMAIL)) { echo("$email is a valid email address"); } else { echo("$email is not a valid email address"); } RE: Problem with valid_email return true for invalid email address - InsiteFX - 03-24-2018 @pooja7r Why did you post and repeat something that I had already posted? |