-3

我有一个 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 代码来在表格中绘制上面的列表。

4

3 回答 3

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>
于 2012-10-12T04:24:09.323 回答
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
?>
于 2012-10-12T04:21:23.267 回答
0

你可以这样使用

    <table>
    <?
    while(condition){
    ?>
<tr>
    <td> <? your data ?></td></tr>
    <?    
    }
    ?>
于 2012-10-12T04:22:01.193 回答