I have a litte problem. I have this code, but this insert in to database only last input value. My function doing a new input, if u click + then coming again new input, but I want all these inputs values in to database, but this code inserting only last input value in to database. Example: I inserting 53424345 and then 56546546, and only 56546546 goes in to database. But I want in to database 53424345, 56546546. Is that possible ? And how to do something like this ?
<table id="mytable">
<tr id="number0" style="display:none;">
<td><?php echo $this->Form->button(' - ',array('type'=>'button','title'=>'Click Here to remove this number')); ?></td>
<td><?php echo $this->Form->input('lisanumbrid'); ?></td>
</tr>
<tr id="trAdd"><td> <?php echo $this->Form->button('+',array('type'=>'button','title'=>'Click Here to add another number','onclick'=>'addNumber()')); ?> </td><td></td><td></td><td></td><td></td></tr>
</table>
<?php echo $this->Html->script(array('jquery-2.1.1.min.js'));?>
<script type='text/javascript'>
var lastRow=0;
function addNumber() {
lastRow++;
$("#mytable tbody>tr#number0").clone(true).attr('id','lisanumbrid'+lastRow).removeAttr('style').insertBefore("#mytable tbody>tr#trAdd");
$("#lisanumbrid"+lastRow+" button").attr('onclick','removeNumber('+lastRow+')');
$("#lisanumbrid"+lastRow+" input:first").attr('numbrid','data[Lisanumbrid]['+lastRow+'][lisanumbrid]').attr('id','numbridlisaNumber'+lastRow);
}
function removeNumber(x) {
$("#lisanumbrid"+x).remove();
}
</script>
Thanks, I accept all hints and solutions.