Hello,

I have a select box with value from 1 to 10 which creates firstname/
lastname textboxes and active checkboxes based on the number selected
using ajax, like this:

View code

Last Name: <input type="textbox" id="membername" name="membername<?php
echo $i;?>" /><br />First Name: <input type="textbox"
id="memberfirstname" name="memberfirstname<?php echo $i;?>" /><input
type="checkbox" id="active" name="memberactive<?php e($i); ?>" />

Where $i is the value of the select box mentionned above. For now, the
only way I figured out to save the form data is to go through a loop
like this:

Controller code

$nb = $this->data['Member']['nb_member']; <----Select box value from 1
to 10
for($i=1;$i<=$nb;$i++) {
        $this->data['Member']['name'] = $this->params['form']['membername'.
$i];
        $this->data['Member']['firstname'] = $this->params['form']
['memberfirstname'.$i];
        if (isset($this->params['form']['memberactive'.$i])) {
                $this->data['Member']['active'] = $this->params['form']
['memberactive'.$i];
        }
}

I'd like to know if there is a better way to do this? I have searched
a lot and didn't find anything.

Thanks in advance

Nicolas

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to