Jump to content

[SOLVED] Check multiples variables with IF


zartzar

Recommended Posts

foreach ($_POST as $key => $val) {
    if (empty($_POST[$key])) {
           echo "{$key} was empty.";
    }
}

 

What might be better is to store the names of the fields you want to check in an array then use an in_array condition in the foreach loop above and check only the values you want to check.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.