How do Insert in the bank for forms on the same page?

Asked

Viewed 47 times

-1

I’m testing a form before I put it into production, because we already have a system that inserts asset movement 1 to 1 and I’m willing to make the operator can do several at the same time, for example, it will move 5 printers to the same place that it does not have to do the process 5 times... inserir a descrição da imagem aqui

then it tells how many products will move and click send and open the number of forms desired

inserir a descrição da imagem aqui

My question is : How do I make so that when he click the first record button he do the update in the bank without leaving the page and if it is not asking too much, appear a message inserted in the 'square' that clicked on record because who will operate it, It’s not very easy with computers. Follows the code.

    <?php


$produtos = $_POST['produtos']



?>

<?php

 for ($i=0; $i < $produtos; $i++) { 
   # code...
?>

    <div class="container">

  <br>

        <div class="row">

            <div class="col-sm-9">

                    <form>
                          <div class="form-group">
                            <label for="exampleInputEmail1">Patrimonio</label>
                            <input name="data[PessoaEmail][0][email_tipo_id]" required="required" id="PessoaEmail0EmailTipoId" type="text" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email">

                          </div>
                          <div class="form-group">
                            <label for="exampleInputPassword1">Teste</label>
                            <input type="text" class="form-control" name="data[PessoaEmail][0][email_tipo_id]" required="required" id="PessoaEmail0EmailTipoId" placeholder="teste">
                          </div>
                      <button type="submit" class="btn btn-success btn-sm">Gravar</button>

                    </form>

            </div>
            <div class="col-sm-3">




            </div>

        </div>

  <br>
    </div>

<?php } ?>
  • Search for asynchronous requests with Javascript.

2 answers

1

If your problem is just when you click the send button do not want the page to reload you can use the Javascript method preventDefault(), but if your doubt is different, try to make it clear so that we can help you.

0

takes the fields from inside the form and uses ajax to send the data.

when you have a button type="Submit" inside a form, whenever the button type="Submit" is triggered, it will update the page and send input data inside that form

Browser other questions tagged

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