Site icon Hip-Hop Website Design and Development

Detail view for an element in a list the admin site

WordPress 5.8.1

function show_list(){
    global $wpdb;
    $table_name = get_table_name();
    $select = "select id, embed_code, comment from $table_name order by id desc;";
    $rows = $wpdb->get_results($select, ARRAY_N);

    $form = '<form id="n-links-form" method="post" action="' . esc_html( admin_url( 'admin-post.php' )) .'">      
    <table>
        <tr>
            <td>Link*</td>
            <td><input name="link"></td>
        </tr>
        <tr>
            <td>Social network*</td>
            <td><input list="social_network" name="social_network">
                <datalist id="social_network">
                    <option value="vk"></option>
                    <option value="fb"></option>
                    <option value="youtobe"></option>
                    <option value="twitter"></option>
                </datalist>
            </td>
        </tr>
        <tr>
            <td>Code*</td>
            <td>
                <input type="text" name="embed_code">
            </td>
        </tr>
        <tr>
            <td>Comment</td>
            <td>
                <textarea form ="n-links-form" name="comment" cols="35" wrap="soft"></textarea>            
            </td>
        </tr>' .
        wp_nonce_field( 'acme-settings-save', 'acme-custom-message')
        .'<tr><td><input type="submit"></td></tr>
    </table>
    </form>';
    echo($form);
    echo("<table>");        
    foreach($rows as $row) {                        
        echo("<tr>");
        echo("<td><a href='" . admin_url( 'admin-post.php' ) . "/?page=nonverbis_links&id=". $row[0] . "'>[n-link=".$row[0]."]</a></td>");
        echo("<td>".$row[1]."</td>");
        echo("<td>".$row[2]."</td>");
        echo("</tr>");
    }
    echo("</table>");
}


function show_detail($id) {
    error_log($id, 0);
    echo("detail");
}


function show_menu(){    
    if ( !($_SERVER["REQUEST_METHOD"] == "GET") ){
        return;
    }

    if ($_GET["id"]) {
        error_log($_GET["id"], 0);
        show_detail($id=$_GET["id"]);
    }
    
    else {
        show_list();
    }
}

function menu(){
    add_menu_page($page_title = 'Nonverbis links', 
                  $menu_title = 'Nonverbis links', 
                  $capability = 'manage_options', 
                  $menu_slug = 'nonverbis_links',
                  $function = 'show_menu' );
}

I have a plugin with links to posts/videos in social networks.
I’d like to have the plugin’s settings in the admin site.

The settings will show a form to add a list below. The first column in the links list.

When a link is clicked, a detail view is supposed to show.

My code shows just a white screen.

The error log is empty. This means that my debug printing to the error log did not happen.

Could you help me?