WordPressUser Submission Form

When you get those “headers already sent” messages, it is usually one of several things:

  1. You are echoing something when you shouldn’t be, which is any time before get_header on the front end. I can’t remember exactly where the window is on the backend.

  2. You are doing something that is triggering a warning or notice that is printing content too soon. Things like if ( $_FILES ) {, while very common, will trigger notices if that variable is not set, and if those print to the screen you have echoed content whether you meant to or not. You should be using !empty($_FILES) or !isset($_FILES) to check the variable.

  3. You are attempting to redirect too late– after the headers have been sent. Usually this means redirecting after get_header.

I see wp_header after your redirect so I expect that the problem is one of the first two possibilities.

As far as your visitors loosing form data, you have that $_POST data. Use it to repopulate the form on failure. This part is really just an HTML question but supply your inputs with value attributes.

<input type="text" id="user_submitted_tags" name="user_submitted_tags" value="<?php if (!empty($_POST['user_submitted_tags'])) echo esc_attr($_POST['user_submitted_tags'])">

Again, not really a WordPress question but to provide your notices, set a variable then echo it conditionally.

else {
    //Notify the user that they must fill out all required fields
    $notice="Fill stuff out";
}

Then in the form somewhere

if (!empty($notice)) {
  echo $notice;
}

Reference

http://codex.wordpress.org/Function_Reference/esc_attr