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) 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? 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. 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. 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 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. 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!! 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
Archived
This topic is now archived and is closed to further replies.