I'm new to wordpress but I really like this and I would love to write my applications inside of wordpress. However there are still many things to learn and after a while one can lose it's head, as I just did. I've been searching for a sollution the last 2 day's on a very simple problem. I want to reload an admin page and pass $_POST variables. Actually I want to write a little crm program inside the admin panel as it is nicely put away from the public (front) section.

Maybe this is not the right way to work, if it isn't please let me know.

The first problem I'm facing is that I can't seem to pass the $_POST variables naam and voornaam when reposting the page. As wordpress passes the page itself as a variable.

this is the simple code:

/** Step 2 (from text above). */
add_action( 'admin_menu', 'patientenbeheer' );

/** Step 1. */
function patientenbeheer() {
    add_menu_page(__('patientenbeheer'), __('patientenbeheer'),'manage_options', basename(__FILE__), 'patientenbeheer_options');

/** Step 3. */
function patientenbeheer_options() {
    if ( !current_user_can( 'manage_options' ) )  {
    wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
    <div class="wrap"> 
    <h2><?php _e('patientenbeheer'); ?></h2>

    <div id="saved"></div>   
    <form action="" method="post" enctype="multipart/form-data">   
    <p>naam: <input type="text" name="naam" value="" /> voornaam: <input type="text" name="vnaam" value="" /><br />    
    <input type="submit" value="Submit" />
    if ( isset($_POST)) {
        if (! isset($_POST['vnaam'])){
            echo "<p> naam: ".$_POST['naam']." </p>";
        }elseif ( ! isset($_POST['naam'])){
            echo "<p> vnaam: ".$_POST['vnaam']." </p>";
        } else {
            echo "<p> beide </p>";


reload returns this: ../wp-admin/admin.php?page=martial-patientenbeheer.php

if I change the form tag to this: I get: ../wp-admin/admin.php?naam=naam&vnaam=

the $_POST values are include but the link is missing the page: martial-patientenbeheer.php. It shoud reload to: ../wp-admin/admin.php?page=martial-patientenbeheer.php?naam=naam&vnaam=

Is this possible or is my working method wrong?

putting it more simply, I want to add text to my page each time variables are passed. Text being the info from a sql select query or fields to add a new patient.


WordPress passes the page as GET but your form uses POST. The two are different things. POST data never shows up in the URL like this: /wp-admin/admin.php?page=martial-patientenbeheer.php?naam=naam&vnaam= It is sent in the headers.

Put var_dump($_POST) at the top of your callback and you should see your post data. You are looking for the data in the wrong place.

  • If this solved the question please mark it as "Accepted". Look for the check mark on the left. – s_ha_dum Aug 1 '13 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.