I need to check if $_POST
variables exist using single statement isset.
if (isset$_POST['name'] && isset$_POST['number'] && isset$_POST['address'] && etc ....)
is there any easy way to achieve this?
I need to check if $_POST
variables exist using single statement isset.
if (isset$_POST['name'] && isset$_POST['number'] && isset$_POST['address'] && etc ....)
is there any easy way to achieve this?
Use simple way with array_diff and array_keys
Use Array to collect data from form as follow:
and process your form on post as below:
That you are asking is exactly what is in
isset
pageis the same as:
If you are asking for a better or practical way to assert this considering that you already have all the required keys then you can use something like:
Remember,
isset
does not return the same result asarray_key_exists