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
Post a Comment