I’ve got a form where I’m doing something based on if two fields were filled out. I’ll refer to these fields as FieldA and FieldB.
What I’m need to do is run a code if both are filled out, another if FieldA is filled only and a third if FieldB is fillled out. If neither are filled out do nothing.
I’m thinking of the following.
I’ve not tested this, but is the best way to do it?
[code]
if (!empty($_POST[‘FieldA’]) && !empty($_POST[‘FieldB’])){
// Both Filled Out
} elseif (!empty($_POST[‘FieldA’]) && empty($_POST[‘FieldB’])){
/// Only Field A Filled Out
} elseif (empty($_POST[‘FieldA’]) && !empty($_POST[‘FieldB’])){
// Only Field B filled out
}