Well, $_POST
is always set, so first statement is not necessary.. Check only if specific fields are set.
EDIT: As noted in comment, isset()
give you only information, if some variable is set, not if it has some value. empty()
can tell you, if you have something in it.
EDIT 2: Just to be sure if empty()
will or will not notice you on undefined POST field, try this:
error_reporting(E_ALL);
var_dump(empty($_POST['undefined']));
You will see that empty()
works with undefined indexes too.