I want this foreach to check for empty values inside the array, and if it exists, display the "error" message. How can I do this correctly?
if (isset($_POST['start'])) {
foreach ($_POST['start'] as $key => $value) {
echo '<br>';
$start2 = mysql_real_escape_string($value); // data da saida
$cod = mysql_real_escape_string($_POST['cod'][$key]);
$id_cotacao = mysql_real_escape_string($_POST['id_cotacao'][$key]);// id
}}
For example:
linha 1 ==> 2017-12-01 | 10 | 21
linha 2 ==> 2017-12-01 | | 21
linha 3 ==> 2017-12-01 | 10 | 21
If it finds an empty variable, it displays the error message.