MK15
asked on
php, logic
hi guys,
I have 3 form fields, i need away to find out which field isset, i don't want to be using several if statements to find out which of the 3 fields have text inputted in. Note, that all 3 may have text in them. After i find out which ones have been set i can add the data to a database after following certain security phases.
e.g. of what i am trying to avoid
thanks in advance guys
I have 3 form fields, i need away to find out which field isset, i don't want to be using several if statements to find out which of the 3 fields have text inputted in. Note, that all 3 may have text in them. After i find out which ones have been set i can add the data to a database after following certain security phases.
$email = $_POST['email'];
$firstname = $_POST['firstname'];
$surname = $_POST['surname'];
e.g. of what i am trying to avoid
if((isset($email)) && (isset($firstname))&&(isset($surname))){
echo 'here';
}
if((isset($email)) && (isset($firstname))){
echo 'here';
}
if((isset($email)) && (isset($surname))){
echo 'here';
}
..........................
thanks in advance guys
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
mate, that is pretty sweet, never would have thought about doing it that way. cheers dude
Glad you liked it.!
Open in new window