I have a combo box populated by a query of all companynames in a table. I need a second combobox to find the related companybranch based on the selected companyname. i'm not sure how to go about doing it. Any hints? I 'do not' have a separate table for companybranch. the table data looks like this:
ID CompanyName CompanyBranch
1 ICBC Accounting
2 ICBC Claims
3 ICBC Autoplan insurance
4 WCB Billing
5 WCB Compensation
the first combox needs to display ICBC, WCB and when either of them is selected then the branch related to it is displayed in the second list.
COMBOBOX1: (this works)
Code: Select all
<?php
$result=mysql_query("select CompanyName from principal group by CompanyName");
$options="";
while ($row=mysql_fetch_array($result)) {
$companyname=$row["CompanyName"];
$options.="<OPTION VALUE=\"$companyname\">".$companyname.'</option>';
}
?>
<select name="CompanyName" >
<option value="0"> < select > <?php echo $options ?> </option>
</select>I'm not sure how to link them, but they must be linked by companyname, not an idnumber.
I'd appreciate the assistance.
Thanks.