Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I really hope I've got a simple issue in front of me here, as it's sort of driving me up a wall.

Short story: submitting a simple form on the front end of the site results in a 302 Found redirect, totally stripping the $_POST data in the process.

Scenario:

  • Create a page in the admin called Edit
  • Create a custom template file (ie, my-edit-template.php) and apply it to Edit

my-edit-template.php:

<?php
/**
 * Template Name: My Edit Template
 */

if ($_POST['action']) {
var_dump($_POST);
} 

get_header(); ?>

<form action="" method="post">
    <input name="my-ornery-field" value="">
    <input type="submit" value="submit">
    <input type="hidden" id="action" name="action" value="update-profile">
</form>

<?php get_footer(); ?>

Now, when I submit the form, I get two requests to the same page, first, the POST, with the form data intact, and second, a GET (status code 200), obviously stripped of the $_POST global, or anything useful to me.

I'm sure this is a total oversight, but I'm at a loss; utterly confused.

I've tried:

  • All plugins disabled
  • Flushing rewrites back to basic defaults
  • POSTing via Javascript/XHR

Help?

I'm sorry if the details are sparse, I'm sort of in class right now, but I'll follow-up with anything else relevant, later.

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

There's nothing wrong with that code. I just did it on a local install and it worked fine, exactly how you'd expect.

Check for conflicting plugins.

share|improve this answer
    
That's part of why this is so irritating, the code is just fine. I'm just hoping for some insight into possible causes, I guess. –  tksb Apr 15 '11 at 19:22
add comment

Your Answer

 
discard

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.