Recently i have been working over a contact module.There are 3 columns ie. name, email, phone and a +1 button which includes anew row to add one more contact filed using ajax.
And here the problem arise. When i update my structure, the data in old contact field vanishes.
Eg:
I entered 2 rows and filled the data as name1, email1, and so on..
name1 email1 phone1
name2 email2 phone2
Now in order to add one more contact filed i use +1 botton. and as soon i click it i get:
blank_1 blank_1 blank_1
blank_2 blank_2 blank_2
blank_3 blank_3 blank_3   //here blank_1, blank_2, blank_3 are just expressing blank columns
My jquery code is :
$(document).ready(function(e) { num = 0; $('#plus_contact').click(function(e) { num = num +1 ; $.ajax({ url : 'contact/contact_form.php', method : 'POST', data : "number="+num, success : function(data) { $('#contact_form_div').html(data); }, }); }); });contact_form.php
<?php
if(isset($_POST['number']) && is_numeric($_POST['number']))
{
    echo $list =$_POST['number'];
    if($list == 1)
    {
        for($i=0; $i<$list;$i++)
        {
        ?>
        <div class="form-group">
            <label class="sr-only" for="exampleInputEmail2">Full Name</label>
            <input type="text" name="c_name[]" class="form-control" id="c_full_name" placeholder="Full  Name">
        </div>
        <div class="form-group">
            <label class="sr-only" for="exampleInputEmail2">Email address</label>
            <input type="email" name="c_email[]" class="form-control" id="c_email_id"  placeholder="Email">
        </div>
        <div class="form-group">
            <label class="sr-only" for="exampleInputEmail2">Phone</label>
            <input type="tel" name="c_phone[]" class="form-control" id="c_phone_number" placeholder="Phone">
        </div>
        <?php
        }
    } } ?>
How can i add a row without altering the old row data ??
 
    