这种形式在一个形式中有多个 tbody。每个 tbody 都包含具有“唯一”值的“隐藏”字段。但是,发送此表单时,它只发送最后一个“pouzivatel_id”值。
例如
我想执行“pouzivatel_id”=4,但表单发送“pouzivatel_id”=“1”
如果不使用多个表单,我将如何解决这个问题?
<form method="post" action="lib/action/admin.post.php">
<table>
<thead>
<tr>
<th>Osobné číslo</th>
<th>Prezývka</th>
<th>Meno</th>
<th>Priezvisko</th>
<th>Operácie</th>
</tr>
</thead>
<tbody>
<tr>
<td>00000000004</td>
<td>user4</td>
<td>user</td>
<td>user</td>
<td>
<input type="hidden" name="pouzivatel_id" value="4"/>
<button type="submit" name="ziadatel-schvalit" class="tlacidlo zelena">Schváliť</button>
<button type="submit" name="ziadatel-zmazat" class="tlacidlo cervena">Zamietnuť</button>
</td>
</tr>
</tbody>
<tbody>
<tr>
<td>00000000003</td>
<td>user3</td>
<td>user</td>
<td>user</td>
<td>
<input type="hidden" name="pouzivatel_id" value="3"/>
<button type="submit" name="ziadatel-schvalit" class="tlacidlo zelena">Schváliť</button>
<button type="submit" name="ziadatel-zmazat" class="tlacidlo cervena">Zamietnuť</button>
</td>
</tr>
</tbody>
<tbody>
<tr>
<td>00000000002</td>
<td>user2</td>
<td>user</td>
<td>user</td>
<td>
<input type="hidden" name="pouzivatel_id" value="2"/>
<button type="submit" name="ziadatel-schvalit" class="tlacidlo zelena">Schváliť</button>
<button type="submit" name="ziadatel-zmazat" class="tlacidlo cervena">Zamietnuť</button>
</td>
</tr>
</tbody>
<tbody>
<tr>
<td>00000000001</td>
<td>user1</td>
<td>user</td>
<td>user</td>
<td>
<input type="hidden" name="pouzivatel_id" value="1"/>
<button type="submit" name="ziadatel-schvalit" class="tlacidlo zelena">Schváliť</button>
<button type="submit" name="ziadatel-zmazat" class="tlacidlo cervena">Zamietnuť</button>
</td>
</tr>
</tbody>
</table>