drdzpknk76046 2016-05-03 13:09
浏览 32
已采纳

PHP + HTML - 如果没有,请隐藏按钮

This is my php code:

if ($value = $rec['ip'] <= $cphigh_ip && $cplow_ip <= $value = $rec['ip'])
{
    $cpyes="on ";
    $realString = $value = $rec['ip'];
    $whmLink=$realString[strlen($realString)-1];
}
else
{
    $cpno="not on cPanel";
}

And the HTML table I have is pretty simple:

<tr>
    <td>Domain IP:</td>
    <td><?=$ipyes.$ipno.$cpyes.$cpno;?><input type="submit" name="cPanelButton" onClick="window.location.href='https://cp<?=$whmLink; ?>.skycomp.ca:2087'" value="cPanel"></td>
</tr>

Is there a way to hide the button in the else clause? or even create the button in that specific in the if statement?

  • 写回答

2条回答 默认 最新

  • dongyuying1507 2016-05-03 13:18
    关注

    You can put button in to php code

    if ($value = $rec['ip'] <= $cphigh_ip && $cplow_ip <= $value = $rec['ip'])
        {
            $cpyes="on ";
            $realString = $value = $rec['ip'];
            $whmLink=$realString[strlen($realString)-1];
            $ifwhmlink = '<input type="submit" name="cPanelButton"   onClick="window.location.href=\'https://cp'.$whmLink.'.skycomp.ca:2087\'" value="cPanel">';
        }
        else
        {
            $cpno="not on cPanel";
            $ifwhmlink = "";
        }
    

    <tr>
        <td>Domain IP:</td>
        <td><?=$ipyes.$ipno.$cpyes.$cpno.$ifwhmlink;?></td>
    </tr>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探