-4

I have more than 30 fields in a form, and can't believe that I must write an array to check if any of them is empty (likehere)

I need something like js

$_POST[].each function{
 if this is empty...
}

and hope that 'php' as so glorified language has something like this or similar.

Community
  • 1
  • 1
qadenza
  • 9,025
  • 18
  • 73
  • 126

1 Answers1

1

Try this:

foreach($_POST as $post)
{
    if( !empty($post) )
    {
        // your code here
    }
}
RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
Mayank Pandeyz
  • 25,704
  • 4
  • 40
  • 59