PHP Header redirect?

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
User avatar
tdlwebs
Forum Members
Forum Members
Posts: 37
Joined: Fri Jan 11, 2008 6:56 pm
Location: Wirral, UK

PHP Header redirect?

Post 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
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: PHP Header redirect?

Post 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');
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Post Reply

Return to “The Lounge”