First, you need to add a counter to the form element names so that the
fields of one record don't get confused with the fields of others:

<?php for ($i=0; $i < count($contacts); $i++): ?>
....
<?php echo $form->text("ProductAdditionalInformation.
$i.contact_content",
           array('value' => $contacts[$i]
['ProductAdditionalInformation']['content'])); ?>
....
<?php endfor; ?>

Second, use saveAll to save all the records at once.
http://book.cakephp.org/view/1031/Saving-Your-Data

On Oct 22, 12:48 pm, Tomfox Wiranata <[email protected]>
wrote:
> hi,
>
> I am retrieving multiple records from a table and echo it via foreach
> in a table. the idea: the user has the opportunity to edit each
> record. for that i display them in textfields:
>
> this is the view where the data is displayed:
>
>         <table id="contact" border="1" cellpadding="0" cellspacing="0">
>
>         <?php foreach ($contacts as $contact): ?>
> <tr>
>
> <td><?php echo $form->text('ProductAdditionalInformation.contact_title', 
> array('value' =>
>
> $contact['ProductAdditionalInformation']['title'])); ?></td>
>
> <td><?php echo $form->text('ProductAdditionalInformation.contact_content', 
> array('value' =>
>
> $contact['ProductAdditionalInformation']['content'])); ?></td>
>
> </tr>
>         <?php endforeach; ?>
>         </table>
>
> now usually, when i save data from a form it works like that:
> $save['Product']['title']= $this->data['Product']['title'];
>
> but how can i make sure, that all records are saved here?
>
> thank you :)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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