I have the problem that my code in a while loop is without the form tag in the first run but in the following runs it's there.
<?php
$num = 1;
while ($row = mysqli_fetch_object($daten)) {
echo "<tr>";
echo "<th>". $num. "</th>";
echo "<td>". htmlspecialchars($row->vname)." ".htmlspecialchars($row->nname)."</td>";
echo "<td>". htmlspecialchars($row->mail)."</td>";
echo "<td>"; ?>
<form action='/resources/user_loeschen.php' method='post'>
<input type='hidden' name='mail' value='<?php echo htmlspecialchars($row->mail); ?>'>
<a onclick='this.parentElement.submit();'><img class='delete' src='resources/img/glyphicons-17-bin.png' height='25px'></a>
</form>
</td>
</tr>
<?php
$num++;
} ?>
so this is the code in the while loop. The form should be always there. The only issue I can imagine is that the while loop itself is in a form too. But the fact that just the first run of the loop fails and the following runs work absolutely fine is a good proof that it can work.
the result html:
<tr>
<th>1</th>
<td>First Test</td>
<td>test.first@test.com</td>
<td>
<input type='hidden' name='mail' value='test.first@test.com'>
<a onclick='this.parentElement.submit();'><img class='delete' src='resources/img/glyphicons-17-bin.png' height='25px'></a>
</td>
</tr>
<tr>
<th>2</th>
<td>Test User</td>
<td>test.user@test.com</td>
<td>
<form action='/resources/user_loeschen.php' method='post'>
<input type='hidden' name='mail' value='test.user@test.com'>
<a onclick='this.parentElement.submit();'><img class='delete' src='resources/img/glyphicons-17-bin.png' height='25px'></a>
</form>
</td>
</tr>
Thanks in advance.