Show/Hide Div Based on URL (PHP)

if (strpos($_SERVER['REQUEST_URI'], "index.php") >= 0) {
  $left_col_class = "showme";
}
else {
  $left_col_class = "hideme";
}

// Your html...
<div id='left_col' class='<?php echo $left_col_class; ?>'>contents</div>

// Your CSS
.hideme { display: none; }
.showme { display: block; }

Comments

Popular posts from this blog

Script For Login, Logout and View Using PHP, MySQL and Bootstrap

PHP Ajax Login Validation Tutorial

New User Registration With Email Verification Using PHP and Mysqli