Hi nmsinc,
Thanks for the extra info!
The easiest way to do this would be to create three separate PHP AJAX scripts that can return the options for your select drop downs in HTML format, and have a function that dynamically updates the three when someone selects something from it. So you'll need to modify the script to something like this:
<script type = "text/javascript">
function populateLists(member) {
ajaxUrl = "accountsList.php?num="+escape(member.value);
$.get(ajaxUrl, function(html){
$('#accounts_drop').html( html );
});
ajaxUrl = "payrollList.php?num="+escape(member.value);
$.get(ajaxUrl, function(html){
$('#payroll_drop').html( html );
});
ajaxUrl = "contractList.php?num="+escape(member.value);
$.get(ajaxUrl, function(html){
$('#contract_drop').html( html );
});
}
</script>
The accountsList/payrollList/contractList script PHP files will need to create what you want to appear inside the select list. You can ensure that it returns the correct options as the num value of what was selected from the member_company dropdown will be passed to the script in the URL.
Finally you need to create the select drop downs that you want the values to appear in, and the original drop down. The code should probably look something like this:
<select name="member_company" onchange = "populateLists(this);">
<option value="">All</option>
<?php foreach (mysql_select("member_companies", "member_type = 'Primary' ORDER BY member_company_name") as $Primary): ?>
<option value = "<?php echo $Primary['num'];?>"><?php echo $Primary['member_company_name'];?> - <?php echo $Primary['city'];?> <?php echo $Primary['state'];?></option>
<?php endforeach ?>
</select>
<br>
<br>
<select name="employee_name" id = "Primary">
<option value="">Please select a company first.</option>
</select>
<br>
<br>
<select id="accounts_drop" name="accounts">
<option value="" >Please select a company first.</option>
</select>
<br>
<br>
<select id="payroll_drop" name="payroll_accounts">
<option value="" >Please select a company first.</option>
</select>
<br>
<br>
<select id="contract_drop" name="contract_work_groups">
<option value="" >Please select a company first.</option>
</select>
<br>
<br>
This is just example code, so you'll need to modify it to get it working with your site.
So when a user updates member_company drop down the JavaScript populateLists function will be triggered, and will pass the selected num value into it. Then it will use ajax to retrieve the options from the three PHP script files (which you will need to create) and will add them to each select dropdown using its ID to find it.
Let me know if you have any questions.
Thanks!
Greg
Greg Thomas
PHP Programmer - interactivetools.com