1
I have a table with 4 columns (name, prova1, prova2, simulated). Suppose you are a teacher, and you wish to post student grades. I return to you the following:
// $l representará o número de linhas que existem
$l = -1;
// $inst2 carrega: SELECT nome, prova1, prova2, simulado FROM alunos
while($dado = mysqli_fetch_row($inst2)) {
$l+=1;
$dados[] = $dado;
}
for ($x=0; $x<=$l; $x++) {
echo "<tr>";
for ($y=0; $y<=3; $y++) {
if ($y==0) {
echo "<td>".$dados[$x][$y]."</td>";
} else {
echo "<td><input type=\"text\" value=\"".$dados[$x][$y]."\" size=\"6\"></td>";
}
}
}
echo "</tr>";
echo "</table>
That is, the ballots of the table in which there are no values registered yet (are null), will have in its content a input
for the teacher to insert the student’s note.
My problem is: I want you to have a button so that after the teacher inserts the notes he will click on it and they will be saved in the database.
I even thought of doing so: put the table that appears on the screen inside a form, and put us inputs text
a name using the variables $x
and $y
. And add a column with an id for each row (auto_increment
). However, I couldn’t move on. Even though I believe there’s a better way to do it.
PS: I I prefer your help using procedural. Thank you!
Want to do this with ajax or load the page again?
– Sergio
I want when the teacher submits the data to show him the new table. That is, with the new values inserted by him.
– HiHello
Ok, and want to do this with ajax or load the page again?
– Sergio
Reload.
– HiHello