Chatrapati Posted August 18, 2013 Share Posted August 18, 2013 HOW TO DO THIS IF A USER ENTER'S SPACE'S " " IN NAME textbox, it should show , the text box is blank what function should we use here? Quote Link to comment https://forums.phpfreaks.com/topic/281295-how-to-eliminate-space-from-textbox-if-user-enters-spaces/ Share on other sites More sharing options...
0xMatt Posted August 18, 2013 Share Posted August 18, 2013 trim() Quote Link to comment https://forums.phpfreaks.com/topic/281295-how-to-eliminate-space-from-textbox-if-user-enters-spaces/#findComment-1445594 Share on other sites More sharing options...
Chatrapati Posted August 18, 2013 Author Share Posted August 18, 2013 No, if a user. enters only spaces in name textbox. it should show "text box is blank" Quote Link to comment https://forums.phpfreaks.com/topic/281295-how-to-eliminate-space-from-textbox-if-user-enters-spaces/#findComment-1445600 Share on other sites More sharing options...
0xMatt Posted August 18, 2013 Share Posted August 18, 2013 There is no function provided by php that does what you are asking. So the answer is correct, you're just wanting somebody to make the code for you instead of doing it yourself. Maybe try learning a bit more basic php so you don't have to wait all day to solve simple dilemmas. if( empty( trim($_POST['name']) ) ) { echo 'Text field _name_ cannot be empty.'; } Quote Link to comment https://forums.phpfreaks.com/topic/281295-how-to-eliminate-space-from-textbox-if-user-enters-spaces/#findComment-1445647 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.