我有一个php标签,我需要在php标签代码中使用html放置一个表。
<div id="box3" class="information">
<?
echo "SHIFT : " . $details['Shift'] . "</br>";
echo "ALARMS : " . $details['alarms'] . "</br>";
echo " Actions Taken : " . $details['Actions Taken'] . "</br>";
echo "Suppression Apparatus : " . $details['Suppression Apparatus'] . "</br>";
echo "EMS Apparatus : " . $details['EMS Apparatus'] . "</br>";
echo "Other Apparatus : " . $details['Other Apparatus'] . "</br>";
echo "Suppression Personnel : " . $details['Suppression Personnel'] . "</br>";
echo "EMS Personnel : " . $details['EMS Personnel'] . "</br>";
echo "Other Personnel : " . $details['Other Personnel'] . "</br>";
?>
我需要一个html代码来在表格中绘制上面的列表。
答案 0 :(得分:2)
<div id="box3" class="information">
<table>
<tr><td>ALARMS : </td><td><?=$details['alarms']?></td></tr>
<tr><td> Actions Taken : </td><td><?=$details['Actions Taken']?></td></tr>
<tr><td>Suppression Apparatus : </td><td><?=$details['Suppression Apparatus']?></td></tr>
<tr><td>EMS Apparatus : </td><td><?=$details['EMS Apparatus']?></td></tr>
<tr><td>Other Apparatus :</td><td><?=$details['Other Apparatus']?></td></tr>
<tr><td>Suppression Personnel :</td><td><?=$details['Suppression Personnel']?></td></tr>
<tr><td>EMS Personnel :</td><td><?=$details['EMS Personnel']?></td></tr>
<tr><td>Other Personnel :</td><td><?=$details['Other Personnel']?></td></tr>
</table>
</div>
答案 1 :(得分:1)
使用此格式来实现它:
<?php
//php code here
?>
<!--regular html code-->
<table>
<tr>
<td><?php echo $var1; ?><td>
<td><?php echo $var2; ?><td>
</tr>
</table>
<!--regular html code ends-->
<?php
//php code here
?>
答案 2 :(得分:0)
你可以这样使用
<table>
<?
while(condition){
?>
<tr>
<td> <? your data ?></td></tr>
<?
}
?>