Web Page Redirect

What are the three ways of redirecting a web page logincheck.php to logged.php using
1. HTML
2. JavaScript
3. PHP

Questions by tallman07

Showing Answers 1 - 1 of 1 Answers

kedarPhp

  • Sep 2nd, 2010
 

At the starting of the logincheck.php page you can add the javascript code as follow

Code
  1. <script language='javascript'>

  2. you can use one of the following

  3. 1:location.href='login.php';

  4. 2:window.location='login.php';

  5. 3:window.location.href='login.php';

  6. </script>

  7. <?php

  8. exit();  //write the exit to exit the current php page execution

  9. ?>

  Was this answer useful?  Yes

1. HTML: You cant redirect a page using HTML

2. JavaScript: window.location = "logged.php" OR window.location.href = "logged.php" OR location.href = "logged.php"
Just so you know if you want to redirect an iframe or a frame in your page then you need to get that Object and redirect.

3. header("Location: logged.php"); exit(); //It is a good practice to call exit() right after redirect so the rest of the code dont get executed

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions