dongmi1941 2017-06-22 05:15
浏览 24
已采纳

显示表格行

I want to display a table row with its button only if my condition is meet (e.g.: if ($row->Estado=='Aceptado')).

Code:

<?php
if ($cotizaciones!= FALSE) {?>  
<table id="verlistacli" class="display" cellspacing="0" width="100%">
<thead>
    <tr>
        <th>Id Cotizacion</th>
        <th>Fecha Cotizacion</th>
        <th>Tipo Trabajo</th>
        <th>Origen del Material</th>
        <th>Material</th>
        <th>Dimensiones</th>
        <th>Cantidad</th>
        <th>Estado</th>
        <th></th>
    </tr>
</thead>
<tbody>
<?php
    foreach ($cotizaciones->result() as $row) {
        echo "<tr>";
            echo"<td>".$row->IdCotizacion."</td>";
            echo "<td>".$row->FechaCotizacion."</td>";
            if ($row->TipoTrabajo==0) {
                echo "<td>Fabricacion</td>";
            }else{
                echo "<td>Reparacion</td>";
            };
            if ($row->OrigenMaterial==0) {
                echo "<td>Empresa</td>";
            }else{
                echo "<td>Cliente</td>";
            };
            echo "<td>".$row->Material."</td>";
            echo "<td>".$row->Alto."x".$row->Ancho."x".$row->Largo."</td>";
            echo "<td>".$row->Cantidad."</td>";
            echo "<td>".$row->Estado."</td>";
            if ($row->Estado=='Aceptado'){
    <td><a class='btn-sm btn-info' href="<?php  echo base_url('profile/detallecotizacioncli/'.$row->IdCotizacion); ?>">Detalles</a></td> 

        }?>
        <?php echo "</tr>";
    }
 ?>
</tbody>
</table>
<input type="button" class="btn btn-default" value="Volver" 
 onclick="history.back(-1)" />
 <?php }else{
        echo "<h2> No hay cotizaciones <h2>";
    }?>

When the condition if ($row->Estado=='Aceptado') is meet, it returns a syntax error.

  • 写回答

1条回答 默认 最新

  • duanqin7791 2017-06-22 05:17
    关注

    Please close php before html.you cant open php tag inside php tag thatswhy its showing syntax error.

    Example

    if ($row->Estado=='Aceptado'){ ?> <!--here you need to close php tag -->
        <td><a class='btn-sm btn-info' href="<?php  echo base_url('profile/detallecotizacioncli/'.$row->IdCotizacion); ?>">Detalles</a></td> 
    
        <?php } ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向