Here is my code
javascript:
<script type="text/javascript">
$(function() {
var scntDiv = $('.create');
var i = $('.create table').size() + 1;
$('.add').live('click', function() {
$('<table><tr><td><input type="text" name="item' + i +'" id="textbox_input" placeholder="Item" /></td><td> <input type="number" name="qtty'+ i + '" id="textbox_number" placeholder="Qtty'+i+'"/></td><td><button type="button" class="remove" id="button">Remove</button></td></tr></table>').appendTo(scntDiv);
i++;
var number = i;
return false;
});
$('.remove').live('click', function() {
if( i > 1 ) {
$(this).parents('table').remove();
i--;
}
return false;
});
}
});
</script>
.html:
<div class="create" style=" padding:10px; width:450px; -moz-border-radius:10px;-webkit- border-radius:10px; top:10px; left:10px; height:540px; background-color:#FFF; position:absolute; overflow:scroll;">
<form method="POST" action="create.php">
<table>
<tr>
<td><input type="text" name="title" id="textbox_input" placeholder="Title"/></td>
<td></td>
<td><input type="submit" value="Save" class="save" id="button" /></td>
</tr>
<tr>
<td><input type="text" name="item1" id="textbox_input" placeholder="Item"/></td>
<td><input type="number" name="qtty1" id="textbox_number" placeholder="Qtty"/></td>
<td><button type="button" class="add" id="button">Add</button></td>
</tr>
</table>
</form>
</div>
i need to transfer the var number to create.php. The form is to create a checklist for users. as they click the add button, the item and quantity field will add. And as the add button is clicked, the var i will increase by 1 and the var number will save the last var i. The question is how to transfer var number to create.php?