get current page name for page active class code example
Example 1: get current page name for page active class
<?php
$url = basename($_SERVER['PHP_SELF']);
?>
//nav bar
<li <?= ($url === "dashboard.php") ? "class='active'"?>><a href='dashboard.php'> Dashboard</a></li>
<li <?= ($url === "bankdetails.php")? "class='active'"; ?>><a href="bankdetails.php"> Bank Account Details</a></li>
Example 2: get current page name for page active class
<?php
$url = basename($_SERVER['PHP_SELF']);
?>
//nav bar
<li <?= ($url === "dashboard.php") ? "class='active'"?>><a href='dashboard.php'> Dashboard</a></li>
<li <?= ($url === "bankdetails.php")? "class='active'"; ?>><a href="bankdetails.php"> Bank Account Details</a></li>