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 have a contact form that each time I refresh the page I get a prompt to resend all the data, I have added a header("location: location.php"); to the bottom of the form function to try and prevent this. However all I get is a Cannot Modify Header Information - Headers already sent error. Here is my code

Template Name: form-test.php
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
include_once(ABSPATH. 'wp-content/themes/fiftyfityNew/contact-form.php');
get_header(); ?>

var i=0;
function test(){

    document.write( "the number is" + i);

<?php function make_user_feedback_form() {
    global $wpdb;
    global $current_user;

        $ufUserID = $current_user->ID;

        if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'updateFeedback' ) {
            $ufDataUpdate = $wpdb->insert( 'wp_user_feedback', array( 'date' => current_time('mysql'), 'responses' => $_POST["test"]) );
    <div id="form">
        <form method="post">
            <li><label for="test">Pick a date Babe:</label><input type="text" id="datepicker" name="test" value="" /></li> <!-- the (name="test") value is what the ('responses' => $_POST["test"]) value is talking too -->

            <li><input name="submit" type="submit" id="submit" class="submit button" value="Send feedback" /></li>
            <?php wp_nonce_field( 'updateFeedback' ); ?>
            <input name="action" type="hidden" id="action" value="updateFeedback" />


header("location: http://localhost:8888/fiftyfity/?page_id=90");



<?php get_sidebar(); ?>
<?php get_footer(); ?>
share|improve this question
This is a php question, not a wordpress question. – mor7ifer Feb 19 '12 at 13:14
up vote 1 down vote accepted

You cannot send headers once you have sent ANY html to the browser...so if you want to do whatever it is you're trying to do with the headers, you'll need it to be before get_header().

On that note, I'm not sure what you're trying to do with the headers, but the 'Confirm Data Resubmission' prompt is coming from your browser. Do a fresh load of the page and then refresh and you shouldn't see it...but there's no way to get around it (because, again, it's from the browser)

share|improve this answer

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.