php - Quick get all variables from $_POST, how to handle undefined if all fields are required? -


i've form fields required thought of doing retrieve variables $_post:

foreach ($_post $key => $value) $$key = $value; 

then validate data , use variables needed.

is there quick way tell if @ least 1 variable undefined without having go isset on each , every 1 of them?

my first idea count how many fields have , compare count:

if (count($_post) == 10) 

but not dynamic, have change number when add new fields.

how can more efficiently?

if want quick , easy way can do:

if(in_array("", $_post)) {     //a field empty } 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -