Dual Drop-down
I am designing a site which has dual drop-downs on it. Based on the user's selection from either dropdown, I am to populate the page with a table containing a database lookup. Headings are different if I select from drop-down 1 versus drop-down 2. I can get it to work for one drop-down but not from both. Here is a snippet of the offending code:
<?php
$sdisc = $_POST['discsl'];
$sdrum = $_POST['drumsl'];
echo($sdrum);
echo($sdisc);
if (is_null($sdrum)) {
$result =odbc_exec($link,"select FMSINO,FMAPPL,FMKIT1,FMKIT2,FMKIT3 from WWWFMSI where FMSINO = '$sdisc'");
echo("<TABLE style='font-family: Arial; font-size: 12pt; color: #FFFFFF' border='1'><TR>");
echo("<TH>Pad No.</TH><TH>Applications</TH><TH>Hardware Kit</TH><TH>Pin Boot Kit</TH><TH>Pad Installation Kit</TH>");
}
elseif (is_null($sdisc)) {
$result =odbc_exec($link,"select FMSINO,FMAPPL,FMKIT1,FMKIT2,FMKIT3 from WWWFMSI where FMSINO = '$sdrum'");
echo("<TABLE style='font-family: Arial; font-size: 12pt; color: #FFFFFF' border='1'><TR>");
echo("<TH>Shoe No.</TH><TH>Applications</TH><TH>All-In-One Kit</TH><TH>Adj. Kit</TH><TH>Drum Brake ProKit</TH>");
}
echo("</TR>");
while(odbc_fetch_into($result,$row_array)!=FALSE){
echo("<TR>");
for ($j =0;$j <odbc_num_fields($result);$j++){
echo("<TD>".$row_array [$j ] . "</TD>");
}
echo("</TR>");
}
echo("</TABLE>");
?>
Either way the data is coming from the same database, but our sales dept requires separate drop-downs. Is there a way to tell PHP which drop-down was used?
|