faqts : Computers : Programming : Languages : PHP : Common Problems : Forms and User Input

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

1 of 2 people (50%) answered Yes
Recently 1 of 2 people (50%) answered Yes

Entry

How do I prevent leading spaces when posting user input in a textarea?

Oct 21st, 2006 03:20
Chad Currie, Lauren Green, http://www.blogvoid.com/category/php-programming/


To remove leading spaces from user input, you can use
$userinput = ltrim($userinput);
if you wish to remove both leading spaces and trailing spaces use
$userinput = trim($userimput);