Here's an example:
if(isset($_POST['nome']) && !empty($_POST['nome'])) {
session_start();
$_SESSION['nome'] = $_POST['nome'];
}
If I can not use this, what would be recommended? I'm trying to take the best security issues for my site.
Interesting quote from a reference displayed in @qmechanik's response:
isset()
tests whether the variable was "started" in>) "and if it is not null .
empty()
can return "true" when the variable was "started" > isset ) for certain values.
Final logic : !empty
checks if it is not empty, so if it is not empty it has started, so !empty
is already enough and does not depend on isset
, unlike isset
that depends on !empty
(this does not remove the fact that you can put isset
and empty
in such a situation) in some situations, finally any thoughts or quotes that contradict this, please answer if possible, thanks. p>