0
I am creating a form where you register by entering 5 data (5 fields), and then when pressing the "Add" button, this data would be added in a "table" below where it shows your number, name and can be edited or removed, while the other 5 fields are empty to add more data, and so until the user click on "Register" where he would register all the "table" data in the database.
<div class="content">
<div class="container">
<div class="row">
<?php require_once 'templates/message.php';?>
<div id="div-superior" class="col-xs-12 col-sm-5 col-md-5 col-lg-5">
<div id="registro-publico" class="row btn-c well">
<form class="form-horizontal" role="form">
<!-- CONTEÚDO AQUI !-->
<!-- BUTTON !-->
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button id="buttons" type="submit" class="btn btn-default">Cancelar </button>
<button id="buttons" type="submit" class="btn btn-default">Adicionar</button>
</div>
</div>
</form>
</div>
<div id="div-button-cad">
<button id="button-cad" type="submit" class="btn btn-default">Cadastrar</button>
</div>
<div id="div-table-quiz-public">
<!-- TABELA AQUI !-->
</div>
</div>
</div>
</div>
</div>
<!-- /container -->
The code is that way. I can not imagine how to do this table interaction, in fact I just need to be able to click on "Add" to be able to insert new data only then, when clicking on "Register" can be inserted all the data in the BD. It is necessary that the user can enter several data according to his will before registering.
I did a lot of research and found nothing related to it. So I don’t know how to start this part.
Dude, you usually log into the database first. Imagine, if the user without wanting to give an F5, he lost what he did that even in the server’s memory is more... Think about if this is really what he wants.
– DiegoSantos
For this case it is possible to create a function to appear a confirmation "model" if it presses "F5" or it clicks "cancel"? It is necessary that it register everything together in some way, or that of to delete if it click on "cancel". But still do not know a way.
– Anonn
It is possible yes, when leaving the page the js can show a message "if it really wants to exit and what data will be lost", but honestly, this can cause a certain discomfort in the user. If you choose to do so anyway, search for the js beforeUnload event.
– DiegoSantos