Hi I'm looking for suggestions on how best to handle the submission of a database table.
So far, I've generated the repeating rows data like so:
<table border=1>
<tr>
<th>Phone Number</th>
<th>Prefix CallerID with</th>
<th>Seconds to ring before<br/>reaching voicemail</th>
<th>Voice mailbox<br/>extension number</th>
<th>Notes</th>
</tr>
<?php
$id = 1;
foreach ( $line_detail as $line ){
echo '<tr>';
echo '<td>'.form::input($id.'_did', $line->did).'</td>';
echo '<td>'.form::input($id.'_cid_prefix', $line->cid_prefix).'</td>';
echo '<td>'.form::input(array($id.'_dial_timeput', 'size'=>15, 'maxlength'=>3), $line->dial_timeout).'</td>';
echo '<td>'.form::dropdown($id.'_extension', $phones, $line->voicemail).'</td>';
echo '<td>'.form::input($id.'_notes', $line->notes).'</td>';
echo "</tr>";
$id++;
}
?>
</table>
And when I submit this I have repeating data like this:
(array) Array
(
[1_did] => 64123456789
[1_cid_prefix] => DDI-
[1_extension] => 800
[1_notes] =>
[2_did] => 645678903
[2_cid_prefix] => TEST-
[2_extension] => 820
[2_notes] =>
[submit] => Save
)
Ok, so now I can group them by id and submit an update to the database. But, I'm wondering if there is a better way of doing this.
Any suggestions?