如何在php中显示隐藏的div

时间:2017-04-19 06:32:44

标签: php html css phpmyadmin

我有lecturer div。我隐藏了这个div。在那之后if($user->hasPermission('admin'))这个函数是真的,我想显示lecturer div。我会像这样放置****个星。我想要那个地方的show div。

<?php

require_once 'core/init.php';

$user = new User();

if($user->isLoggedIn()) {

?>
<li><a href="logout.php">Log Out</a></li>

 <div class="lecturer" id="lecturer" style="display: none;">
  <label for="studentID">Student ID</label>
 </div>

<?php

if($user->hasPermission('admin')){
echo '<p>You are the admin</p>';
********I want to show lecturer dive here*************
}

}else {


echo '<p>You need to <a href="login.php">login</a> or <a href="register.php">register</a>';

}

1 个答案:

答案 0 :(得分:0)

尝试:

<?php

require_once 'core/init.php';

$user = new User();

if($user->isLoggedIn()) {

?>
<li><a href="logout.php">Log Out</a></li>

 <div class="lecturer" id="lecturer" style="display: none;">
  <label for="studentID">Student ID</label>
 </div>

    <?php

    if($user->hasPermission('admin')){
    echo '<p>You are the admin</p>';
    echo '<div>Lecturer</div>';
    } 
    }else {


echo '<p>You need to <a href="login.php">login</a> or <a href="register.php">register</a>';

}