My code:
<?php
$testthis[] = 0;
$mysql = new mysqli("host","name","password","database");
if($mysql->connect_error) {
echo "connection error: ".mysqli_connect_error()."<br/>";
}
else {
echo "<p>succeed</p>";
}
$result = $mysql->query("SELECT * FROM t_table;");
while($line = $result->fetch_array()) {
$help = $line["sNr"];
echo "<tr><td>".htmlspecialchars($line["sNr"])."</td>"
."<td>".htmlspecialchars($line["c2"])."</td>"
."<form action='my.php' method='post'>"
// **Here is the mess:**
."<td>"."<input type='text' name='$help' value='$help' onchange=".$testthis[$help] = $_POST[$help]."/>"
."</td>"
."\n </tr></form>";
}
?>
My idea is, that sNr
equals the index of an array so that I can later easily write the input from the html (what will be some kind of count or size) to an other table on my database (with sNr
as foreign key).