Keith,
First of all, the structure for a select field is:
<select name="some_name">
<option value="value1"></option>
<option value="value2"></option>
<option value="value3"></option>
.
.
.
</select>
The only arguments that the <option> tag accepts are "value" and "selected", "name" is defined in the select tag. As to determining the value of the field selection, you'd do something like this:
<?php
$selected_value = $some_name;
?>
However, as a server-side technology, PHP can't pick up changed values unless the user manually submits the form. To do what you're asking you'd have to use client-side scripting like JavaScript to auto-submit the form when the value of the field is changed (I'm not sure what the code is of the top of my head, but I'm sure someone else can post it or you can find it in one of the JS code repositories). You may be able to accomplish the same ends using VBScript or ASP also. I'd caution you against relying on client-side technology too heavily, or at all for application critical operations, as it puts too many factors out of your hands as the developer. IMHO, client-side is great for additional functionality, features, and appearance.... but should be used only as add-ons. Core functionality such as error checking, data validation, essential behaviour should always be coded server-side to make sure it works for every user on every browser. Just my $0.02🙂 HTH!!
Cheers,
Geoff A. Virgo
You'll need to