somebody pls help me...
i'm very new in php...i have a problem when search database using multiple dropdownlist...
i call so many function like below to search
....either user select one dropdown list..
either two dropdownlist and all selected...
how can i combine all together in one function?call one function only whatever selection that user made..
some part in html:
<select name="Location" id="Location">
......
</select>
<select name="Subject" id="Subject">
.......
</select>
<select name="Semester" id="Semester">
...........
</select>
some part in php...
if (isset($_POST['submit'])) {
if ($_POST['Location'] && $_POST['Subject'] && $_POST['Semester'] ){
.....
$staff=$staff->getLecturers_Loc_Sub_Sem($_POST['Location'],$_POST['Subject'],$_POST['Semester']);}
else if ($_POST['Location'] && $_POST['Subject']){
.......
$staff=$staff->getLecturers_Loc_Sub($_POST['Location'],$_POST['Subject']); }
else if ($_POST['Location'] && $_POST['Semester']){
...........
$staff=$staff->getLecturers_Loc_Sem($_POST['Location'],$_POST['Semester']); }
else if ($_POST['Subject'] && $_POST['Semester']){
.......
$staff=$staff->getLecturers_Sub_Sem($_POST['Subject'],$_POST['Semester']); }
else if ($_POST['Location']){
.............
$staff=$staff->getLecturers_Loc($_POST['Location']); }
else if ($_POST['Subject']){
..............
$staff=$staff->getLecturers_Sub($_POST['Subject']); }
else if ($_POST['Semester']){
...........
$staff=$staff->getLecturers_Sem($_POST['Semester']); }
some sql statement when search location and subject in this function...
getLecturers_Loc_Sub($id1,$id2); {
....
$sql= "select * from intake i,intake_subject ij, staff_subject ss
where i.location=$id and ss.subject=$id2
and i.id=ij.intake and ij.subject=ss.subject group by ss.staff";
.....
}