在php中的活动导航栏

I have made a menu bar in a separate file and included it all pages. I am trying to achieve a good active php code to make my navigation bar active when I am on the page even on the dropdown. Most of the time I do get errors using the $_GET method. If anyone could help me with a simple active function using php that would be great.

Page: nav.php

if ($_GET['table'] != 'users')
{ $page1 = 'none'; } else { $page1 = 'active'; }
if ($_GET['table'] != 'carrier_exceptions')
{ $page2 = 'none'; } else { $page2 = 'active'; }.............

     <nav>
        <ul>
            <li><a href="#Users">Users</a></li>
            <li class="dropdown"><a href="#Carrier_Exceptions" class="dropbtn">Carrier Exceptions</a>
                <div class="dropdown-content">
                    <a href="#Carrier_Costing">Carrier Costing</a>
                    <a href="#Carrier_Code">Carrier Code</a>
                    <a href="#Carrier_Service_Code">Carrier Service Code</a>
                </div>
            </li>
            <li><a href="#Markup_Percent">Markup Percent</a></li>
            <li><a href="#Service_Code">Service Code</a></li>
            <li><a href="#Snap_Activity_Pricing">Snap Activity Pricing</a></li>
            <li><a href="#Vat">Vat</a></li>
            <li><a href="#Country_Code">Country Code</a></li>

            <li style="float:right"><a href="#Logout">Logout</a>
        </ul>
    </nav>