Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/02/2022 in all areas

  1. No need to mess about exploding the URI - just use $_GET['page']. <style type='text/css'> a { color: gray; text-decoration: none; } a.active { color: red; font-weight: 600; } </style> <?php $selectedPage = $_GET['page'] ?? ''; // get selected page (or empty if there isn't one) $pageArray = array( 'Page1', 'Page2', 'Page3', 'Page4' ); echo "<ul>\n"; foreach ($pageArray as $p) { $act = $selectedPage == $p ? 'active' : ''; // if this is the selected page, add 'active' to class echo "<li><a class='pageitem $act' href='?page=$p'>$p</a></li>"; } echo "</ul>\n"; ?> Result
    1 point
This leaderboard is set to New York/GMT-05:00
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.