Glese Posted December 2, 2011 Share Posted December 2, 2011 I do want to validate a password input field to only allow numbers and letters without special character and spaces, and I also do want the same for the name input field. Since the old fashioned ways are deprecated. How would one approach to solve this issue the new way? Quote Link to comment https://forums.phpfreaks.com/topic/252301-text-string-validation/ Share on other sites More sharing options...
canabatz Posted December 2, 2011 Share Posted December 2, 2011 function safe($value){ return mysql_real_escape_string($value); } if($_POST['submit']) { $username1=safe($_POST['username']); $password=safe($_POST['password']); .......more code here Quote Link to comment https://forums.phpfreaks.com/topic/252301-text-string-validation/#findComment-1293417 Share on other sites More sharing options...
QuickOldCar Posted December 2, 2011 Share Posted December 2, 2011 http://php.net/manual/en/function.ctype-alnum.php Quote Link to comment https://forums.phpfreaks.com/topic/252301-text-string-validation/#findComment-1293422 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.