ASP Response.Redirect vs. PHP Header location

My old ASP habits are sometimes hard to break… I like the simpler redirect equivalent of ASP compared to the PHP header location command:

// redirect to thank you page
 header( 'Location: /thankyou.php' ) ;

So… I just made a function and put it in my include/common.php file.

// Function: Redirect()
// Description: Redirect user to another page/url, similar to ASP Response.Redirect()
function Redirect($url) {
   header( 'Location: ' . $url ) ;    
} // function Redirect

So now, I can just use the simpler and easier to remember:

Redirect('/thankyou.php');
This entry was posted in Uncategorized. Bookmark the permalink.