well, it is not always easy for me this
but better is to tell a bit what you want in specific situation
when testing if some POST field was not filled
I use something like this.
Note, I use [man]trim[/man]
because if somebody entered 1 or more spaces only, then string is not empty,
but trim will remove such spaces, leading/trailing spaces
and so string will be REALLY empty, if only spaces were entered
if one or one or one or one is empty
<?php
$vMonth = trim($_POST['month']);
$vDay = trim($_POST['Day']);
$vYear = trim($_POST['Year']);
$vTime = trim($_POST['Time']);
if ( empty($vMonth) || empty($vDay) || empty($vYear) || empty($vTime) ) {
exit( 'You must fill in all fields. Go back please.');
}
echo 'Thank you! You submitted:<br><br>';
echo $vMonth. ' =month<br>';
echo $vDay. ' =day<br>';
echo $vYear. ' =year<br>';
echo $vTime. ' =time<br>';
?>
you can also use this way
if not ( one or one or one or one is empty )
<?php
$vMonth = trim($_POST['month']);
$vDay = trim($_POST['Day']);
$vYear = trim($_POST['Year']);
$vTime = trim($_POST['Time']);
if ( !( empty($vMonth) || empty($vDay) || empty($vYear) || empty($vTime) ) ) {
echo 'Thank you! You submitted:<br><br>';
echo $vMonth. ' =month<br>';
echo $vDay. ' =day<br>';
echo $vYear. ' =year<br>';
echo $vTime. ' =time<br>';
}else{ // one of them was empty
exit( 'You must fill in all fields. Go back please.');
}
?>
For some reading about 'IF' and TRUE / FALSE
http://php.net/manual/en/language.types.boolean.php#language.types.boolean.casting
http://php.net/manual/en/language.control-structures.php#control-structures.if
But best is to get some practical way of your own to handle this.
Regards 🙂