2
The problem is this, I have an html table that is filled inside a while in a BD query, in this table some fields are inputs and I need to insert the data entered in this input in my BD.
I was thinking of getting them in another php file by POST, only that way as the names
I don’t think it would go very well.
I don’t know if I could explain it properly, but I’ll leave the code:
while ($linha = mysqli_fetch_array($notas, MYSQLI_ASSOC))
{
$cpfAluno = $linha["Aluno_CPF"];
$pegaNomeAluno = "SELECT Nome FROM aluno WHERE CPF = '$cpfAluno' ORDER BY Nome";
$nomeAluno = mysqli_query($con, $pegaNomeAluno);
$alunoArray = mysqli_fetch_array($nomeAluno, MYSQLI_ASSOC);
$aluno = implode(', ', (array)$alunoArray);
echo "<tr>";
echo "<td>";
echo $aluno;
echo "</td>";
echo "<td>";
echo "<input id='prova1' maxlength='2' size='1' name='prova1' class='form-control'>";
echo "</td>";
echo "<td>";
echo "<input id='prova2' maxlength='2' size='1' name='prova2' class='form-control'>";
echo "</td>";
echo "<td>";
echo "<input id='media' maxlength='2' size='1' name='media' class='form-control'>";
echo "</td>";
echo "</tr>";
}
Do you want to save one row at a time ? or the entire table?
– Felipe
good to be honest I don’t know what difference it would make by adding everything at once or line by line, but I want to add all the lines that are returned in that while in my bank. Example if there are 10 students in the class will be created 10 lines by while, each row will be a new record in the database, these records will be made when you click a button to submit
– Akimoto
Difference would be in how to pick up the objects and save, through which way you want to inerate with the database, if each row would have a save button, or if it would have a "save" button to save all the data from the table. If it is the second option, I would indicate organizing the objects in javascript function by taking the elements of the DOM and sending the objects pro php. If so, I can post an example code of how to get these elements.
– Felipe
It’s the second way you’ve talked, a button for all the data, please post the code, I’m still learning and know very little about javascript
– Akimoto
If you can not resolve comment in response, if you can , Mark as solved .
– Felipe