I am getting last inserted row in save page when adding dynamically inserting each row.
any body help me i want to get all records in save page.

my add-remove-row.php is

    <form action="save.php"  method="post" name="assigndate"  enctype="multipart/form-data" >

<table rules="all" style="background:#fff;">
<td style="font-size:14px;" >Name</td>
<td style="font-size:14px;">Email</td>
<td style="font-size:14px;">Mobile</td>
<td><span style="font:normal 12px agency, arial; color:blue; text-decoration:underline; cursor:pointer;" onClick="addMoreRows(this.form);">
Add More
<tr id="rowId">
<td><input name="name" type="text"   id="name" size="17%"/></td>
<td><input name="email" type="text" id="email" /></td>
<td><input name="mobile" type="text" id="mobile"   /></td>

<div id="addedRows"></div>

<input type="submit" name="submit" id="submit" value="submit"/>


<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
var rowCount = 1;
function addMoreRows(frm) {
rowCount ++;
var recRow = '<p id="rowCount'+rowCount+'"><tr><td><input name="name" id="name" type="text" size="17%"  maxlength="120" /></td><td><input name="email" id="email" type="text"  maxlength="120" style="margin: 4px 5px 0 5px;"/></td><td><input name="mobile" id="mobile" type="text" maxlength="120" style="margin: 4px 10px 0 0px;"/></td></tr> <a href="javascript:void(0);" onclick="removeRow('+rowCount+');">Delete</a></p>';

function removeRow(removeNum) {


and my save page is save.php



echo $name;
echo $email;
echo $mobile;


The reason you code can just get the last added items is probably because the tructure you design will only add rows with the input elements with same name and id which are 'name','email' and 'mobile' means the form only will post one name, one email and one mobile to your save.php
If I am in the case, I will probably add the rowCount to the input name such as <input name="name'+rowCount+'" id="name'+rowCount+'" type="text" size="17%" maxlength="120" /> and so as email and mobile field.
And I will create a hidden input to store the rowCount to send to save.php. In save.php I will read the rowCount and use a for loop to loop the data posted.

Very thanks problem is solved but i am not getting while clicking button

my modified code is

<title>jQuery add / remove textbox example</title>

      <script src="jquery.min.js"></script>

<style type="text/css">



<h1>jQuery add / remove textbox example</h1>

<script type="text/javascript">

$(document).ready(function() {
    var max_fields      = 10; //maximum input boxes allowed
    var wrapper         = $(".input_fields_wrap"); //Fields wrapper
    var add_button      = $(".add_field_button"); //Add button ID

    var x = 1; //initlal text box count
    $(add_button).click(function(e){ //on add input button click
        if(x < max_fields){ //max input box allowed
            x++; //text box increment
            $(wrapper).append('<div><input type="text" name="mytext[]"/><input type="text" name="email[]"/><input type="text" name="mobile[]"/><a href="#" class="remove_field">Remove</a></div>'); //add input box


    $(wrapper).on("click",".remove_field", function(e){ //user click on remove text
        e.preventDefault(); $(this).parent('div').remove(); x--;

$("#getValue").click(function() {

 var mytext1=$("#mytext").val();


 <form name="myform" action="save1.php" method="post" enctype="multipart/form-data" >
<div class="input_fields_wrap">
    <button class="add_field_button">Add More Fields</button>
    <div><input type="text" name="mytext[]" id="mytext">
    <input type="text" name="email[]" id="email">
    <input type="text" name="mobile[]" id="mobile"></div>
<input type="button" value="getValue" id="getValue">
 <input type="submit" name="submit" />