WordPress.org

Support

Support » Plugins and Hacks » admin backend: show page inside admin area

admin backend: show page inside admin area

  • I am developing a plugin, that can edit values in a database. The plugin is showing pages in the backend to manage the content. I have a problem to show a page after an action of a form. The basic structure is this:

    if (isset($_POST['form_action_Show'])) {
        show_seminare();
    }
    if ($_POST['form'] == "SeminarEditSelect") {
        show_seminar_edit();
    }
    
    function show_seminare() {
        echo "<div class=\"FormDivSeminare\">";
        echo "<h3>Seminare</h3>";
        echo "<form name=\"form_editseminar\" method=\"post\" action=\"".action_page()."\" >\n";
        echo "<input name=\"form\" value=\"SeminarEditSelect\" type=\"hidden\" />\n";
    
    ...
    }
    
    // Adminmenu Optionen erweitern
    function add_menus() {
        add_menu_page('Seminare Verändern', 'Seminare', 8, __FILE__, 'show_seminar_main');    
    
        add_submenu_page(__FILE__, 'Seminare Anzeigen', 'Anzeigen', 8, 'show_seminare', 'show_seminare');
    }

    If I try to edit a seminar via the button ‘SeminarEditSelect’, the function ‘show_seminar_edit()’ is called. But the output is NOT inside the backend, it is above everything, even above the html-header.

    So it is completely wrong. How solve this simple error?

Viewing 1 replies (of 1 total)
  • Is this your main plugin file? If it is, those if switches are going to run as soon as the plugin initializes, which is why your function echoes content above everything else. You need to call that function at the place in the code where you want it to show up.

Viewing 1 replies (of 1 total)
  • The topic ‘admin backend: show page inside admin area’ is closed to new replies.
Skip to toolbar