I have a form in which I am adding new rows in one of the div through jquery
<div class="packs">
<div>
<input type="text" placeholder="Enter Name" name="pname" id="pname" value="Test" />
<img class="add-icon" src="media/icon/add.png" height="30" width="30">
</div>
</div>
In jquery, I am doing this:
$(document).ready(function(){
$(".packs").on('click', '.add-icon', function () {
$(".packs").append('<div><input type="text" placeholder="Enter Name" name="pname" id="pname" value="Test" /><img class="add-icon" src="media/icon/add.png" height="30" width="30"></div>');
});
});
What I need is to get array of all the elements which I have added.
$_POST['pname'] is returning only last entered element.
Can someone suggest what to do here.