1

so this is driving me crazy I understand the error. But I am trying to redirect to the page regardless. meaning : if condition = 1 => redirect to this page... or redirect to another. any other alternatives?

Sam
  • 7,252
  • 16
  • 46
  • 65
cppit
  • 4,478
  • 11
  • 43
  • 68

2 Answers2

2

Have you tried using <?php ob_start(); ?> at the start of the page?

Zy0n
  • 810
  • 2
  • 14
  • 33
1

You need to make sure nothing is being sent to the browser before you send the redirect header. One possible solution (although quick and dirty) is using output buffering, so at the start of the page put

<?php
ob_start();
// any code you need to check whether to redirect
// note that output from between the ob_start()
// and the ob_end_clean() won't be sent to the user
ob_end_clean();

and then do your redirection checks and redirection. Remember, don't let anything output. So no echos, etc.

Eva Lauren Kelly
  • 403
  • 1
  • 4
  • 15