HTML表格中的额外列

时间:2015-07-11 04:13:59

标签: php

我是否知道如何在我的桌子上有一个额外的栏目,我无法调试付款ID和更新付款栏?我的代码如下。 注意:由于我没有足够的声誉,我无法发布图片。

  <td width="52">Bookng id</td>     
    <td width="78">Deposit</td>
    <td width="149">Total_amt_paid</td>
    <td width="149">Balance</td>
    <td width="149">Payment status</td>
    <td width="57">Card type</td>
     <td width="62">Total price</td>
     <td width="94">Payment id</td>
     <td width="62"></td>
    <td width="293">Update Payment</td>
  </tr>
  <?php do { ?>
  <tr>
    <th height="45"><?php echo $row_RecordsetUpdatePayment['Booking_id']; ?></th>

    <th><?php echo $row_RecordsetUpdatePayment['Deposit']; ?></th>
    <th><?php echo $row_RecordsetUpdatePayment['Total_amt_paid']; ?></th>
    <th><?php echo $row_RecordsetUpdatePayment['Balance']; ?></th>
    <th><?php echo $row_RecordsetUpdatePayment['Payment_status']; ?></th>
    <th><?php echo $row_RecordsetUpdatePayment['Card_type']; ?></th>
    <th><?php echo $row_RecordsetUpdatePayment['Total_price']; ?></th>
    <th><?php echo $row_RecordsetUpdatePayment['Payment_id']; ?></th>
   <th><?php if($row_RecordsetUpdatePayment['Payment_status'] == 'Fully Paid'){
               echo "<th><span style='color:grey' href='UpdatePayment.php?Payment_id=".$row_RecordsetUpdatePayment['Payment_id']."'> Update</span></th>"; }
              if($row_RecordsetUpdatePayment['Payment_status'] == 'Partial'){ 
              echo "<th><a href='UpdatePayment.php?Payment_id=".$row_RecordsetUpdatePayment['Payment_id']."'> Update</a></th>";
              }
               ?>
             </th>

2 个答案:

答案 0 :(得分:1)

我在你的代码中看到两个问题:

首先,你应该摆脱第一行的空白

<tr>
    <td width="52">Bookng id</td>     
    <td width="78">Deposit</td>
    <td width="149">Total_amt_paid</td>
    <td width="149">Balance</td>
    <td width="149">Payment status</td>
    <td width="57">Card type</td>
    <td width="62">Total price</td>
    <td width="94">Payment id</td>
    <td width="293">Update Payment</td>
</tr>

其次,您正在打开<th>标记并检查内部条件并在条件中打开新的<th>标记,因此您的代码应该类似于:

<th><?php echo $row_RecordsetUpdatePayment['Deposit']; ?></th>
<th><?php echo $row_RecordsetUpdatePayment['Total_amt_paid']; ?></th>
<th><?php echo $row_RecordsetUpdatePayment['Balance']; ?></th>
<th><?php echo $row_RecordsetUpdatePayment['Payment_status']; ?></th>
<th><?php echo $row_RecordsetUpdatePayment['Card_type']; ?></th>
<th><?php echo $row_RecordsetUpdatePayment['Total_price']; ?></th>
<th><?php echo $row_RecordsetUpdatePayment['Payment_id']; ?></th>
<?php if($row_RecordsetUpdatePayment['Payment_status'] == 'Fully Paid') {
  echo "<th><span style='color:grey' href='UpdatePayment.php?Payment_id=".$row_RecordsetUpdatePayment['Payment_id']."'> Update</span></th>";
} else {
echo "<th><a href='UpdatePayment.php?Payment_id=".$row_RecordsetUpdatePayment['Payment_id']."'> Update</a></th>";
} ?>

应该是它。

答案 1 :(得分:0)

从标题行中删除额外的<td>

<tr>
    <td width="52">Bookng id</td>     
    <td width="78">Deposit</td>
    <td width="149">Total_amt_paid</td>
    <td width="149">Balance</td>
    <td width="149">Payment status</td>
    <td width="57">Card type</td>
    <td width="62">Total price</td>
    <td width="94">Payment id</td>
    <td width="293">Update Payment</td>
</tr>