codeboy89 Posted December 1, 2009 Share Posted December 1, 2009 It will not give an error if there is no @ in the input elseif(strlen(trim($_POST['email'])) == 0 || strlen(trim($_POST['email'])) > 50 || strpos(trim($_POST['email'],'@')) === false) Quote Link to comment https://forums.phpfreaks.com/topic/183642-whats-wrong-with-this-tiny-snippet/ Share on other sites More sharing options...
Maq Posted December 1, 2009 Share Posted December 1, 2009 Well, what's the error? Quote Link to comment https://forums.phpfreaks.com/topic/183642-whats-wrong-with-this-tiny-snippet/#findComment-969262 Share on other sites More sharing options...
mrMarcus Posted December 1, 2009 Share Posted December 1, 2009 ^diddo. Quote Link to comment https://forums.phpfreaks.com/topic/183642-whats-wrong-with-this-tiny-snippet/#findComment-969265 Share on other sites More sharing options...
premiso Posted December 1, 2009 Share Posted December 1, 2009 Remove the trim as you are not closing the paran and I do not think it can be used like that, and it does not need to be trimmed if you are just checking for a character in that string. Try that and see if it helps. Quote Link to comment https://forums.phpfreaks.com/topic/183642-whats-wrong-with-this-tiny-snippet/#findComment-969266 Share on other sites More sharing options...
mikesta707 Posted December 1, 2009 Share Posted December 1, 2009 this strpos(trim($_POST['email'],'@')) === false should be strpos(trim($_POST['email']),'@') === false your parentheses were formatted incorrectly edit premiso beat me to it, nevermind Quote Link to comment https://forums.phpfreaks.com/topic/183642-whats-wrong-with-this-tiny-snippet/#findComment-969268 Share on other sites More sharing options...
salathe Posted December 1, 2009 Share Posted December 1, 2009 Please always make sure that you have the error reporting level cranked up (e.g., error_reporting(E_ALL);) and that PHP errors are displayed (e.g., ini_set("display_errors", "1");) when writing your code. It would have caught this problem for you with a helpful error message. Quote Link to comment https://forums.phpfreaks.com/topic/183642-whats-wrong-with-this-tiny-snippet/#findComment-969275 Share on other sites More sharing options...
codeboy89 Posted December 1, 2009 Author Share Posted December 1, 2009 Thanks mikesta!! Quote Link to comment https://forums.phpfreaks.com/topic/183642-whats-wrong-with-this-tiny-snippet/#findComment-969280 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.