Tools, FAQ, Tutorials:
Removing Leading and Trailing Spaces in PHP
How To Remove Leading and Trailing Spaces from User Input Values?
✍: FYIcenter.com
If you are taking input values from users with a Web form, users may enter extra spaces at the beginning and/or the end of the input values. You should always use the trim() function to remove those extra spaces as shown in this PHP script:
<?php $name = $_REQUEST("name"); $name = trim($name); # $name is ready to be used... ?>
2016-10-13, 335👍, 0💬
Popular Posts:
How To Select an Exiting Database in PHP? The first thing after you have created a connection object...
How To Insert Rows Based on SELECT Statements in PHP? If want to insert rows into a table based on d...
What Are the Attributes of a "table" Element? A "table" element may have the following commonly used...
How To Control Table Widths? Usually, browsers will calculate the table width based on the content w...
How To Pad an Array with the Same Value Multiple Times in PHP? If you want to add the same value mul...