Perl vs. PHP: Multiple Select

This is a really annoying behavior with PHP.

In order to access form variables in a multiple select box, you need to rename the box with array brackets at the end. If you don’t, PHP will only populate the $_POST assoc. array with the last element selected.

e.g. <select multiple name=”vars[]“>

Whereas with Perl, you can get the values from a normally-named multiple select box because mod_perl actually sticks all the selected options in a dereferencible array.

Comments are closed.