I have a form that would post the values to a php page, which would bind to ldap and get the user records.
I am able to do an ldap bind and get the record if my query is the following.

$query = "(|(telephonenumber=" . $_POST['telephonenumber'] .")(sn=" . $_POST['sn'] . ")(mail=" . $_POST['email'] . "))";

My web page has fields such as fn, ln, phone, email.

if a user enters the fn and ln or phone and fn, or email and fn to perform a search then how should I change the query according to the webpage?