On Tuesday 03 December 2002 23:45, Dev wrote:
> Hello all
>
> Currently I have a web fom that has 3 field in it that I want writing to a
> multidimensional array.
>
> <TR>
>       <TD><INPUT TYPE="text" NAME="address[]" VALUE=""></TD>
>       <TD WIDTH="50" ALIGN="center"><INPUT TYPE="text" NAME="address[]['state']"
> VALUE="" SIZE="5" MAXLENGTH="5"></TD>
>       <TD COLSPAN="2"><INPUT TYPE="text" NAME="address[][]['zip']"
> VALUE=""></TD> </TR>

I would name them as:

  NAME="address[][address]"
  NAME="address[][state]"
  NAME="address[][zip]"

(I'm assuming you have multiple addresses on a single form)

Then loop through them by:

  foreach ($address as $key => $value) {
    echo "Address: {$value['address']} State: {$value['state']} Zip: 
{$value['zip']}";
  }
          
For a single address use:

  NAME="address[address]"
  NAME="address[state]"
  NAME="address[zip]"

And no need to loop, just use the values directly.


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
The best portion of a good man's life, his little, nameless, unremembered acts
of kindness and love.
                -- Wordsworth
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to