最佳答案
I read somewhere that the isset()
function treats an empty string as TRUE
, therefore isset()
is not an effective way to validate text inputs and text boxes from a HTML form.
So you can use empty()
to check that a user typed something.
Is it true that the isset()
function treats an empty string as TRUE
?
Then in which situations should I use isset()
? Should I always use !empty()
to check if there is something?
For example instead of
if(isset($_GET['gender']))...
Using this
if(!empty($_GET['gender']))...