dongyu9667 2018-11-12 17:51
浏览 22

PHP if语句带有空查询

I am new to coding. I am trying to get a different text on one of my button if the field is empty. The original code is:

<?php if ( $clpr_options->coupon_code_hide ) {
        $button_text = fl_get_option( 'fl_lbl_show_coupon' );
        $button_text = '<i class="icon-lock"></i>' . $button_text;
        $class .= ' coupon-hidden';
}
     ?>

now I changed it to:

<?php if ( $clpr_options->coupon_code_hide ) {
        $button_text = fl_get_option( 'fl_lbl_show_coupon' );
        $button_text = '<i class="icon-lock"></i>' . $button_text;
        $class .= ' coupon-hidden';
    } else {
        $coupon = get_post_meta( $post->ID, 'clpr_coupon_code', true );
        $coupon == '';
        $button_text = 'Angebot anzeigen';
}
     ?>

however it does not change the content it still shows the first if need some help.

Its not about $button_text being empty, I would like to change the $button_text if there is no content within clpr_coupon_code

Thanks for helping...

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

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