* Thus wrote Ford, Mike               [LSS] ([EMAIL PROTECTED]):
> On 27 August 2003 04:22, Aris Santillan wrote:
> 
> > I Have
> > <p>Entry One
> > <input type=text name=name[]>
> > <input type=text name=tel[]>
> > <input type=checkbox name=check[] value=1>
> 
> The way to combat this is to use explicit subscripts in your form field names, like 
> so:
> 
>  <p>Entry One
>  <input type=text name=name[1]>
>  <input type=text name=tel[1]>
>  <input type=checkbox name=check[1] value=1>

I would also add some structure to avoid all the different
variables and makes looping much smoother on the processing script.

<input type=text name="elements[2][name]">
<input type=text name="elements[2][tel]">
<input type=checkbox name="elements[2][checked]" value="1">

Then:

foreach ($_REQUEST['elements'] as $id => $element) {
  
  if ($element['checked']) {
    // its checked
  } else {
    // not checked.. duh..
  }
}


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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

Reply via email to