Surround your variables with {} curly braces.
--
Scott Carr
OpenOffice.org
Documentation Maintainer
http://documentation.openoffice.org/
Quoting Bill Hudspeth <[EMAIL PROTECTED]>:
> I am trying to write a function that builds a multiple-choice drop down
> list. As such, I need to specify an array in the name attribute of the
> <select> tag. I am trying to pass a parameter to the function which gets
> used as this name attribute, but seem to be having problems with the square
> brackets. In the example below, I would like to submit the $elementname
> variable to a function, but can't get it to take the '[' and ']' characters.
> My resultant $_POST[] variable is empty. Any hints?
>
>
>
>
>
> HARD-CODED VERSION
>
>
>
> echo "<select name='cgroup_1[]' multiple size='5'>";
>
> echo "<option value = '$chon_group_a[1]'
> selected>$chon_group_a[1]</option>";
>
> echo "<option value = '$chon_group_a[2]'>$chon_group_a[2]</option>";
>
> echo "<option value = '$chon_group_a[3]'>$chon_group_a[3]</option>";
>
> echo "<option value = '$chon_group_a[4]'>$chon_group_a[4]</option>";
>
> echo "</select>";
>
>
>
> //the $chon_group_a is a locally defined array that does not seem to be
> causing any problems
>
>
>
> DESIRED FUNCTION VERSION
>
>
>
> $elementname="cgroup_1[]";
>
> $elementsarray=$chon_group_a;
>
> PrintOptionBox($elementname,$elementsarray);
>
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php