Return to Snippet

Revision: 42278
at March 2, 2011 18:19 by chopbust


Initial Code
function redirect($new_location){
	echo ("<script type='text/javascript'> 
	document.location.replace('$new_location');
	</script> ");
	die();
}

Initial URL

                                

Initial Description
Redirect page using PHP function.

I don't like using header() as I like to redirect page mid-page. This is implemented using Javascript written through PHP function. Has a die() function at the end for people who has disabled their Javascript in their browser.

Initial Title
Redirect a page using Javascript through PHP

Initial Tags

                                

Initial Language
PHP