For this PHP navigation, you will see that "Services" has a "sub-menu". All the other menu links have an "active" state when clicked on (they have a white background determined by the "active" class in the CSS).

How can I get "Services" to be in the "active" state when one of the "sub-menu" items is selected?

PHP Code:
<nav id="access" class="access" role="navigation">
           
            <div id="menu" class="menu">
                
                <ul id="tiny">
                
                <?php
        $full_name 
$_SERVER['PHP_SELF'];
        
$name_array explode('/',$full_name);
        
$count count($name_array);
        
$page_name $name_array[$count-1];
    
?>
    <li><a class="<?php echo ($page_name=='index.php')?'active':'';?>" href="index.php">Home</a></li>
    <li><a class="<?php echo ($page_name=='about.php')?'active':'';?>" href="about.php">About</a></li>
    <li><a class="<?php echo ($page_name=='services.php')?'active':'';?>" href="#">Services</a>
    <ul>
        <li><a href="asset-allocation-strategies.php">Asset Allocation Strategies</a></li>
        <li><a href="cash-flow-strategies.php">Cash Flow Strategies</a></li>
        <li><a href="charitable-giving-strategies.php">Charitable Giving Strategies</a></li>
        <li><a href="education-planning.php">Education Planning</a></li>
        <li><a href="estate-planning.php">Estate Planning</a></li>
        <li><a href="financial-planning.php">Financial Planning</a></li>
        <li><a href="insurance-advice.php">Insurance Advice</a></li>
        <li><a href="tax-planning.php">Tax Planning</a></li>
    </ul>
    </li>
    <li><a class="<?php echo ($page_name=='getting-started.php')?'active':'';?>" href="getting-started.php">Getting Started</a></li>
    <li><a class="<?php echo ($page_name=='resources.php')?'active':'';?>" href="#">Resources</a>
    <li><a class="<?php echo ($page_name=='client-portal.php')?'active':'';?>" href="#">Client Portal</a>
    <li><a class="<?php echo ($page_name=='blog.php')?'active':'';?>" href="blog.php">Blog</a>
    <li><a class="<?php echo ($page_name=='contact-us.php')?'active':'';?>" href="contact.php">Contact Us</a>
                                   
                </ul>
                
            </div>
            
        </nav>