I'm trying to generate a set of N buttons, one for each row of a DB table, I need to show a <div>
by putting his style="display:none"
to style="display:block"
when one of the buttons is clicked, this <div>
will show a form.
Until now i got this:
home.PHP
<div id="add" style="display:none;">
<form action="#" method="post" id="form">
<div src="close" id="close" onClick="div_hide()">X</div>
Aggiungi
<input type="text" name="soldi" id="campo" placeholder="Soldi">
<a id="submit" href="">
<button>Aggiungi</button>
</a>
</form>
</div>
<?php
while($sezioni = mysqli_fetch_assoc($sezione_sql)){
echo "<div class =\"sezione\">
<a id=\"popup\" onclick=\"div_show()\">
<div class=\"pulsante\">add</div>
</a>
</div>";
}
?>
java.JS
function div_show() {
document.getElementById('add').style.display = "block";
}
function div_hide(){
document.getElementById('add').style.display = "none";
}
How could I call a function on submit that will update a determinated DB row getting in input an ID of the pressed button?