我加载一个xml文件,并在此循环生成一个html表。在表格的每一行上,我有两个图标更新和删除。 当我点击icone删除(例如),我想获得该行的索引或该行的任何信息,以便处理删除我的xml文件中的节点。 我通过传递参数给php函数尝试使用echo $ number,但在php文件中GET是空的。如何获取由foreach生成的html表的索引/数据
你知道我该怎么得到它吗?预先感谢。
<table>
<?php
foreach($participants as $participant)
{
$number = $participant->number;
$name = $participant->name;
$note = $participant->note;
$sexe = $participant->sexe;
$group = $participant->group;
$adjust = $participant->adjust;
?>
<tr>
<td align="center"><?php echo($number) ?></td>
<td align="left" style="padding-left:10px"><?php echo($name) ?></td>
<td align="center"><?php echo($note) ?></td>
<td align="center"><?php echo($sexe) ?></td>
<td align="center"><?php echo($group) ?></td>
<td></td>
<td>
<a href="php/updateParticipant.php5"><img src="images/migatiEditUser20x20.jpg"></a>
<a href="php/deleteParticipant.php5?number=<?php echo($number) ?>"><img src="images/migati_cancel16x16.png"></a>
</td>
</tr>
<?php }?>
</table>
deleteParticipant.php <?php echo ($_GET['number']); ?>
我只是在你的foreach中有一个计数器,然后使用值 – ediblecode
是的,但是当foreach完成....? –