What is the best practice for handling sublinks in PHP when clicking on a top link?

When clicking on a top link in PHP that has sublinks, it is best practice to use a conditional statement to determine which sublink was clicked and then execute the corresponding action or display the appropriate content. This can be achieved by passing a parameter in the URL or using a form submission to identify the selected sublink.

<?php
// Check if a sublink was clicked
if(isset($_GET['sublink'])) {
    $sublink = $_GET['sublink'];

    // Execute action or display content based on the selected sublink
    switch($sublink) {
        case 'sublink1':
            // Code for sublink1
            break;
        case 'sublink2':
            // Code for sublink2
            break;
        // Add more cases for additional sublinks as needed
    }
}
?>