You can't put $a[][] inside a qouted string like that. Either use
${a[][]} or put it outside like this:
Print(" <option value=\"".$aOptions[1][0]."\">".$aOptions[1][1]."\n");
-Rasmus
On Thu, 14 Mar 2002, Mauricio Cuenca wrote:
> Hello,
>
> I've built a function that receives an array as an argument to create an
> HTML drop-down list, but when I try to print the list this is all I got:
> <select name="my_list">
> <option value="Array[0]">Array[1]
> <option value="Array[0]">Array[1]
> </select>
>
> This is my code:
> -------------------
>
> Function TextList($sName, $aOptions)
> {
> $nCount = Count($aOptions); //Counts the elements of the array
> Print(" <select name=\"$sName\">\n");
> For ($i = 1; $i <= $nCount; $i++)
> {
> Print(" <option value=\"$aOptions[1][0]\">$aOptions[1][1]\n");
> }
> Print(" </select>\n");
> }
>
> */ Now I build the array */
> $my_array = Array( Array(0,0), Array(1,"Enero"), Array(2,"Febrero"),
> Array(3,"Marzo"), Array(4,"Abril");
>
> */ And call the function */
> TextList("my_list", $my_array);
>
> I need to know how exaclty can I pass and receive an array as a function
> argument. Hope you can help me, TIA.
> --
>
>
> Mauricio Cuenca
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php