如果用户付款了,我试图使整个NAV链接消失,但是我只能使文本消失,但会出现错误。
这是我的代码:
<li> <a class=" " href="paynow.php" aria-expanded="false">
<span class="hide-menu"> <?php echo $unlockcourse ?></span></a>
</li>
Php代码:
$haspaid = ($userinfo['id_haspaid']) * 1;
$unlockcourse="";
if($haspaid==0){
$unlockcourse="- Unlock Full Course";
}else if($haspaid==1)
$unlockcourse="";
{
}
我希望隐藏整个部分,现在文本已隐藏,因此我仍然可以单击不可见的链接
答案 0 :(得分:1)
尝试此代码。
PHP:
$haspaid = ($userinfo['id_haspaid']) * 1;
$unlockcourse = true;
if($haspaid == 0){
$unlockcourse = true;
} else if ($haspaid == 1) {
$unlockcourse = false;
}
HTML:
<?php if ($unlockcourse == true) { ?>
<li>
<a href="paynow.php" aria-expanded="false">
<span class="hide-menu">-Unlock Full Course</span>
</a>
</li>
<?php } ?>