Redirect page with a simple function


/ Published in: PHP
Save to your folder(s)

very useful function that allows you to redirect to the user to a given location


Copy this code and paste it in your HTML
  1. function redirect($location) {
  2. if ($location !=NULL) {
  3. header("Location: {$location}");
  4.  
  5. } // End of above if statment.
  6.  
  7. } // End of function.
  8.  
  9. //usage example
  10. $location = 'sample.php';
  11. redirect($location);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.