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

Hyperledger Development with in 10 days — Day 6

Insert CheckBox and Radio button Data in MySQL Database Using PHP