I have the following code to check user input:
if(isset($_POST['block_name']) && !empty($_POST['block_name'])) {
$block->name = trim($_POST['block_name']);
}
But it accepts SPACE as valid input, so I changed to this:
if(isset($_POST['block_name']) && !empty($_POST['block_name']) && trim($_POST['block_name'])!='') {
$block->name = trim($_POST['block_name']);
}
I have found on web that I can use !=false as well. What is the difference and which is recommended.
emptyfirst. Your question regardingfalseis also answered in the manual.