-
-
Save antonioanerao/a04f3e5c06c6de86834124e24bdd4fd4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once("autoload.php"); | |
$crud = new Crud(); | |
?> | |
<!DOCTY E html> | |
<html> | |
<head> | |
<title></title> | |
</head> | |
<body> | |
<?php | |
if(isset($_POST['cadastrar'])) | |
{ | |
$insert = $crud -> insert('users', 'nome = ?, cpf = ?', array($_POST['nome'], 'cpf')); | |
echo "ok"; | |
} | |
?> | |
<form method="post" name="cadastrar" action="http://localhost/inputs/"> | |
<button class="btn btn-success" href="javascript:void(0)" | |
id="addInput"> | |
<span><i class="fa fa-plus-square" aria-hidden="true"></i> Adicionar</span> | |
</button> | |
<div id="dynamicDiv"> | |
<div class="row"> | |
<div class="col-lg-8"> | |
<br><input class="form-control" name="nome[]" type="text"> | |
</div> | |
</div> | |
</div> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> | |
<script> | |
$(function () { | |
var scntDiv = $('#dynamicDiv'); | |
$(document).on('click', '#addInput', function () { | |
$( | |
'<div class="row">' + | |
'<div class="col-lg-8">' + | |
'<br>' + | |
'<input class="form-control" placeholder="" name="nome[]" type="text">' + | |
'</div>' + | |
'</div><br>').appendTo(scntDiv); | |
return false; | |
}); | |
}); | |
</script> | |
<br> | |
<input type="submit" name="cadastrar" value="Cadastrar"> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment