MemphiS Posted June 26, 2007 Share Posted June 26, 2007 i have a script where i check the content that the user inputs and works perfect. But ive found when i click enter for a new line it will return false how can allow a new line... Thanks Quote Link to comment Share on other sites More sharing options...
Wuhtzu Posted June 26, 2007 Share Posted June 26, 2007 Please post the code you use to validate/check the user input... Quote Link to comment Share on other sites More sharing options...
MemphiS Posted July 4, 2007 Author Share Posted July 4, 2007 bumP i use ctype,str_replace for it Quote Link to comment Share on other sites More sharing options...
Wuhtzu Posted July 6, 2007 Share Posted July 6, 2007 First off I hope you have solved your problem by now, but if you haven't I would suggest that you use regular expression to validate your user input since it is as configurable as anything gets... <?php $user_input = "Text of line one\ntext of line two\ntext of line three"; if(preg_match("/^[a-z0-9\s]+$/",$user_input)){ echo "User input is valid"; } else{ echo "User input not valid"; } ?> The above code checks if the user input consists of letters a-z, digits 0-9 and whitespace which includes tabs, spaces and line breaks. Quote Link to comment 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.