Is there an efficient way of processing part of a form that has three input fields. If all are empty then don't do anything, but if one is filled, all must be filled.
At the moment I have this
if (isset($_POST['desc1']) && !empty($_POST['desc1'])){
$email_message .= $_POST['desc1']. " - " . $_POST['code1']. " - Amount: " .$_POST['quant1']."<br>";
$toadd .= $_POST['desc1']. " - " . $_POST['code1']. " - Amount: " .$_POST['quant1']."<br><br>";
}
Problem is they could have entered the desc1
but not the code1
or quant1
and it will fire anyway. If they entered code1
or quant1
and not the desc1
nothing will happen, which again is a problem, I would like to display this as an error and have them go back and try again.