CodeIgniter Forums
Problem with php header() - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Problem with php header() (/showthread.php?tid=59116)



Problem with php header() - El Forum - 08-27-2013

[eluser]Unknown[/eluser]
Hello,
I am new to CodeIgniter and I started off, moving my old website to a Framework, which is obviously Codeigniter. The whole html part is working great but I've ran into some problems with my old php Code I somehow can't resolve, even with many google-searches.
The thing is I am trying to let people accept the Terms and Conditions before registering. For this I use a form beneath my terms with a Checkbox and a submit button. Now when the user ticked the checkbox and pressed on the submit button I want to redirect him to a new page. Without the Framework I used the header('location:...') function, which is somehow not working now anymore.
My Code:

the pages.php part for the specific page:
Code:
public function registration()
{

        $data['title']= "skyline. Registration";
  $this->load->view('pages/regform_redirect', $data);
         $this->load->view('templates/head', $data);
        $this->load->view('pages/registration', $data);
        $this->load->view('templates/right_side', $data);
         }

the redirect part (regform_redirect.php):
Code:
<?

date_default_timezone_set('Germany/Berlin');
if ($_POST['start'])
  {

  if(isset($_POST['accept']))
{
header('location: http://new.skyline-va.de/co/regform');

}


  }


?>

There is no error message or something similar at all. It seems as if this function somehow doesn't show any reaction. I've already tested putting an echo"hello"; instead of the header to see if the code is just failing to execute the if command but this wasn't the case.

Does someone know if there is an issue to the header() command with codeigniter or if there is an alternativ?
Thanks in advance.
Lauritz


Problem with php header() - El Forum - 08-27-2013

[eluser]Unknown[/eluser]
Ok, I got this working now. I found out somewhere else, that putting an ob_start(); in the first line of the index.php of CodeIgniter solved this issue.
Lauritz