WordPress.org

Ready to get started?Download WordPress

Forums

The quest of the lost $_POST (2 posts)

  1. david_treblig
    Member
    Posted 3 years ago #

    -- I am sorry : yes there are many other posts to treat that problem, but they are closed and none is answered --

    I am currently developing a plugin which adds a form in another's plugin page through actions.

    In fact, to be precise, I am adding a form to the current activity form of BuddyPress, but since this problem is not BuddyPress related, I am asking here.

    When I submit the form, the $_POST data returned is always empty when I include code into my plugin. What I mean is that my plugin goes like this :

    Check if buddypress is loaded
    then load form.php

    In form.php, there is the mentioned form and its logic of analysing the $_POST when submitted.

    I also figured out that when I put the $_POST logic in the main plugin file, I can access the $_POST data, but I can't use wp_nonce_field to verify the integrity of the data AND the page redirects to the home page of the blog.

    What, in the word of WordPress gods, is interfering with normal html/php code so that simple task doesn't work?

  2. hyzerfool
    Member
    Posted 2 years ago #

    I had a similar problem. I could pass data to my plugin using GET, but POST data never showed up. I finally realized that if my form pointed to a directory:

    http://mysite.com
    http://mysite.com/wordpress

    then my POST data disappeared and $_POST was empty. If I pointed to a specific file:
    http://mysite.com/wordpress/index.php

    Then it worked properly.

    I post that here only for reference for the next poor sap who tears their hair out over this.

Topic Closed

This topic has been closed to new replies.

About this Topic