solution:
go to http://www.javascript.com javascripts faq and check the form section.
simple answer:
onChange="javascript: this.form.submit();"
will send out a form withe value you seleced.
detail answer:
for example, you grab the data from the database and save them in an array, employecode[]
and you can also check the $selected_employeecode to grab the data for one employee, if $selected_employeecode is empty then the employee data is empty.
if there is a match, then you can grab the employee inforamtion and fill it out in the text fields.
this is a approach you can use.
<form name="myform" method="post" action="employees.php">
<select name="selected_employeecode" onChange="javascript: this.form.submit();">
<?php
for ($index=0; $index<$employee_count; ++$index)
{
?>
<option value="<?php echo(htmlentities($employeecode[$index])); ?>" <?php if ($employeecode[$index]==$selected_employeecode) { ?> selected <?php } ?>><?php echo(htmlentities($employeecode[$index])); ?>
</option>
<?php
}
?>
</select>
</form>