0

Header already sent after form submission, I'm using a redirect to take my form elements to a new page to process them, but i'm getting the header Headers ALready Sent error and I cannot see why.

Is there an better cleaner way to do this?

if(isset($_POST["associate"])) {

  $partner = $_POST['partner'];
  $location = $_POST['location'];

  $redirect = plugins_url() . "/myremovalsquote/inc/associate.php?partner=" . $partner . "&location=" . $location . "";

  header('Location: '.$redirect);

 } else {
  echo 'Failed';
}
Brad Fletcher
  • 3,547
  • 3
  • 27
  • 42
  • 2
    what do you mean by a better cleaner way? Why not just fix the headers issue http://stackoverflow.com/questions/8028957/how-to-fix-headers-already-sent-error-in-php – Funk Forty Niner Nov 18 '15 at 17:38

1 Answers1

0

Are you using wordpress? Than the problem is maybe caused by plugins_url (). When the error still occurs please double check that there is no data sent to the client (e.g <html> or even a whitespace) before header () is used.