Page 1 of 1

PHP Header redirect?

Posted: Fri Feb 21, 2014 4:08 pm
by tdlwebs
I am re-designing and converting an existing site to CMSMS. One of the pages has this PHP right at the top:

Code: Select all

<?php
if(isset($_POST['Submit'])) {
		$event = $_POST['event'];
		if($event != "exit") {
			$location = $event.'/';
			header('Location:'.$location);
		}
	}
?>
and further down within the page content there is a select element with a drop down list and when one of the options is selected the page redirects to the chosen option.

I understand that a PHP header event has to be the very first thing that happens before anything else on the page. So, my question is: How can I get this to work with CMSMS?

Any help very gratefully received,

T

Re: PHP Header redirect?

Posted: Fri Feb 21, 2014 4:25 pm
by calguy1000
CMSMS has a redirect() function that handles this.

If the headers are already sent, it uses javascript to perform the redirection.

redirect('http://mysite.com/some_url');