Create and delete form fields

Asked

Viewed 54 times

0

Colleagues.

I have a system developed this time with PHP of which I register in BD the number of participants of a given event. With these amounts, I create the form fields. See:

    <?php
    ....
    while($jm = mysqli_fetch_object($sqlCampos)){
    ?>

    <input type="text" name="NomePessoas[]" class="form-control" maxlenght="100">

    <?php } // Fim do while($jm = mysqli_fetch_object($sqlCampos)) 
?>

So far all right, but I need to make the user delete or add fields and when adding/deleting, change in BD the amount registered.

How I would do this in Ajax/Jquery?

Thank you!

  • 1

    Take this example field addition with dynamic validation.

  • 1

    You have to create a new page php, which will be called by ajax whenever an item is added or removed, on this page you will update the database based on the received parameters, to make a call jQuery see this one link, to duplicate vc you can use the example given by @Brunowego.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.