WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm writing code from within a plugin and I'm attempting to create a two-part registration form. I'm using POST to determine if the first part of the form was submitted or not. Unfortunately, though, the POST data is not coming through. Here is what my form looks like:

<form action="<?php echo $_SERVER['REQUEST_URI'] ?>" method="post">
<input type="submit" name="user_info_form" id="user_info_form" />

This should POST back to the same page, in theory. I then use the below code to read the POST data.

echo "found data";
echo "nothing found";

Unfortunately, "nothing found" is being outputted following a form submission.

Is there any reason for this that has to do with WordPress? I've been at this for hours now so any help is very much appreciated!

share|improve this question
what do you get when you print_r( $_POST )? – mor7ifer Feb 2 '12 at 11:20
I'm getting all of the other POST data, so that seems to be working okay. However, I'm not getting the submit button's post data which means it's not being sent to the right place maybe? What should the action of the form be? – Evan Feb 2 '12 at 15:48
try just action='', see if that gets the post data in there – mor7ifer Feb 2 '12 at 23:13
That was the first thing I tried :) – Evan Feb 4 '12 at 2:01
If you use Chrome's 'Inspect Element' tool (or equivalent in your browser of choice), what do you see for the action of the form? – mor7ifer Feb 4 '12 at 3:39

Did you try adding a value to the input field? It looks like you are using a submit input field, not a text input field. <- Never mind, it still isn't null after submitting.

In order to troubleshoot, try adding the following to the top of your code:

echo 'Post variables:<br />';

Also, where are you placing this code? I dropped your code straight in to the header.php file of a custom theme and it worked as expected.

share|improve this answer
Yes, I'm checking to see if the submit button was clicked. I do not care about the text field. Did I misunderstand you? – Evan Feb 2 '12 at 4:21
Actually, I just checked, even with no specified value in the submit input field, I'm still seeing 'Submit' come through. I've edited above, have a look. – Exit Feb 2 '12 at 4:32
Sorry, but what did you edit? I don't see any changes :) – Evan Feb 2 '12 at 4:35
Check again, was sidetracked... – Exit Feb 2 '12 at 4:45
All of the code you see there is inside of a plugin file which I believe becomes part of a page (I'm 99.99% positive about that). So, to answer your question, I'm posting and retrieving the post from inside of a wordpress page. What should I be putting in the header?? – Evan Feb 2 '12 at 5:24

What about adding a hidden input field to the code?

<form action="<?php echo $_SERVER['REQUEST_URI'] ?>" method="post">
    <input type="hidden" value="1" name="form_submitted" />
    <input type="submit" name="user_info_form" id="user_info_form" />

Then compare to the hidden field's value. Does that make any difference?

share|improve this answer
up vote 0 down vote accepted

I found my own answer on this one (just now). The stupid plugin had javascript at the bottom of the page disabling all submit buttons from working - what a joke, sorry everyone.

share|improve this answer
<form action="<?php echo $_SERVER['REQUEST_URI'] ?>" method="post">
<input type="submit" name="user_info_form" id="user_info_form" />

I think there is a syntax error in the PHP. It should end with a semicolon, like this:

<form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
<input type="submit" name="user_info_form" id="user_info_form" />
share|improve this answer
not a syntax error. – Milo Jul 8 '14 at 2:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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