Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to save multiple instances of data using one form in CakePHP
    primarykey
    data
    text
    <p>I have built a screen where an administrator can add and edit users. I'm able to add users without issue, but when I was testing how users can be edited, I noticed that if I have more than one user, I'm only be able to edit the last user thats listed. I'm unable to edit any other user.</p> <p>Here is my code:</p> <pre><code>&lt;?php foreach ($personel as $person) { ?&gt; &lt;div id="edituser&lt;?php echo $person['Personel']['id']; ?&gt;" class="modal" style="display:none;"&gt; &lt;?php $edituserformname = "editUser" + $person['Personel']['id']; ?&gt; &lt;div class="modal-header"&gt; &lt;a class="close" data-dismiss="modal"&gt;×&lt;/a&gt; &lt;h3&gt;Edit User - &lt;?php echo $person['Personel']['firstname']; ?&gt; &lt;?php echo $person['Personel']['surname']; ?&gt;&lt;/h3&gt; &lt;/div&gt; &lt;div class="modal-body iframed"&gt; &lt;?php echo $ &lt;?php echo $this-&gt;Form-&gt;create('Personel', array( 'class' =&gt; 'form-horizontal', 'id' =&gt; $edituserformname )); echo $this-&gt;Form-&gt;input('id', array( 'type' =&gt; 'hidden', 'value' =&gt; $person['Personel']['id'] )); echo $this-&gt;Form-&gt;input('firstname', array( 'type' =&gt; 'text', 'label' =&gt; 'First Name', 'class' =&gt; 'span5', 'value' =&gt; $person['Personel']['firstname'] )); echo $this-&gt;Form-&gt;input('surname', array( 'type' =&gt; 'text', 'label' =&gt; 'Surname', 'class' =&gt; 'span5', 'value' =&gt; $person['Personel']['surname'] )); echo $this-&gt;Form-&gt;input('email', array( 'type' =&gt; 'text', 'label' =&gt; 'E-Mail', 'class' =&gt; 'span5', 'value' =&gt; $person['Personel']['email'] )); echo $this-&gt;Form-&gt;input('companyid', array( 'type' =&gt; 'hidden', 'value' =&gt; $company['Company']['id'] )); echo $this-&gt;Form-&gt;input('accesslevel', array( 'label' =&gt; 'Access Level', 'options' =&gt; $roles, 'empty' =&gt; 'Select Access Level', 'class' =&gt; 'span5', 'value' =&gt; $person['Personel']['accesslevel'] )); $pocval = array('1' =&gt; 'Yes', '0' =&gt; 'No'); echo $this-&gt;Form-&gt;input('poc', array( 'label' =&gt; 'Point of Contact?', 'options' =&gt; $pocval, 'value' =&gt; $person['Personel']['poc'] )); echo $this-&gt;Form-&gt;input('password', array( 'type' =&gt; 'text', 'label' =&gt; 'Password', 'class' =&gt; 'span5', 'value' =&gt; $company['Personel']['password'] )); echo $this-&gt;Form-&gt;input('telephone', array( 'type' =&gt; 'text', 'label' =&gt; 'Telephone', 'class' =&gt; 'span5', 'value' =&gt; $company['Personel']['telephone'] )); echo $this-&gt;Form-&gt;input('type', array( 'type' =&gt; 'hidden', 'value' =&gt; '0' )); ?&gt; &lt;/div&gt; &lt;div class="modal-footer"&gt; &lt;?php echo $this-&gt;Form-&gt;submit('Save &amp; Close', array( 'type' =&gt; 'submit', 'class' =&gt; 'btn btn-primary', 'id' =&gt; 'editusermodal' )); echo $this-&gt;Form-&gt;end(); ?&gt; &lt;/div&gt; &lt;/div&gt; &lt;?php } ?&gt; </code></pre> <p>How can I fix this issue? I had an idea about using iFrame's but I'm reluctant to use this method. I'd rather be able to do it through CakePHP.</p> <p>Many thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload