WordPress.org

Ready to get started?Download WordPress

Forums

No data in $_POST (2 posts)

  1. syced
    Member
    Posted 10 months ago #

    Hello,

    I'm writing a front-end function where a user fills in a form. But for some mysterious reason it doesn't send any data through $_POST.

    This is my material:
    - I have two WordPress running at one server with two different accounts.
    - Account_A has the latest 3.6.1 WP version and my script works great.
    - Account_B was outdated, I just updated it to 3.6.1 but my script doens't work.

    Account_B is the client's website. Thats why I scripted it first at Account_A and made it work there. There are several plugins running at Account_B (ACF/Gravityforms/Members/Wordpress SEO Yoast) and there are 0 plugins (besides my own I'm creating right now) running at Account_A

    The code:

    <form action="<?php echo $siteurl; ?>/dictee/" method="post">
                        <label>Voornaam</label>
                        <input name="voornaam" />
                        <label>Achternaam</label>
                        <input name="achternaam" />
                        <label>E-mailadres</label>
                        <input name="emailadres" />
                        <input type="submit" value="Ga verder" />
                    </form>

    PHP code (on top of the template file):

    if($_SERVER['REQUEST_METHOD'] == 'POST') {
    
    				$voornaam = $_POST['voornaam'];
    				$achternaam = $_POST['achternaam'];
    				$emailadres = $_POST['emailadres'];
    }

    Resuls are empty.
    Now when I create this plugin without WordPress (so basicly run it at the root with pluginnaam.php) It works great. But once it makes use of the "rewriting" it fails to parse any data.

    The weirdest thing is, on installation A it works fine the way it should. But installation B fails at parsing the data.

    Does anybody have any idea wich or what can be bugging with installation B?

    My "thoughts" are that the problem goes with the rewriting, since a stand alone version works fine (meaning the server should not be the problem). On the other hand, Installation A works great with the same rewriting.

  2. Chris
    Member
    Posted 10 months ago #

    The rewriting should not be a problem. A redirect on the otherhand would be, according to the RFC 2616.

    First I would check if your site is being redirected (maby by one of the plugins).

    If that's the case either using GET instead of POST might do the trick. I haven't tested it but as I understand some browsers will turn POST data into GET data when doing a redirect?!

    http://dev-tricks.net/post-data-lost-on-301-moved-permanently

Reply

You must log in to post.

About this Topic