hunglduc Posted March 20, 2009 Share Posted March 20, 2009 i used header("Location:http://www.google.com"); but it was not successful and gave a error. Can u please help me Link to comment Share on other sites More sharing options...
ProblemHelpPlease Posted March 20, 2009 Share Posted March 20, 2009 You can include <meta http-equiv="Refresh"content="5;url=http://www.w3schools.com"> in your <head> here </head> tagThis is not php but will give you the result you need. Link to comment Share on other sites More sharing options...
jlhaslip Posted March 20, 2009 Share Posted March 20, 2009 What was the error?Are Headers already sent? Link to comment Share on other sites More sharing options...
TKW22 Posted March 20, 2009 Share Posted March 20, 2009 What was the error?Are Headers already sent?i think its when you put that after you sent html to the page like this.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title></title> </head> <body> <?php header("Location:http://www.google.com"); ?> </body></html> try putting in before html that normally works like this <?php header("Location:http://www.google.com"); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title></title> </head> <body> </body></html> if your getting the Headers already sent error Link to comment Share on other sites More sharing options...
hunglduc Posted March 21, 2009 Author Share Posted March 21, 2009 What was the error?Are Headers already sent?when i run these code, it appeared errorWarning: Cannot modify header information - headers already sent by (output started at /opt/lampp/htdocs/redirect.php:8) in /opt/lampp/htdocs/redirect.php on line 10<html><head><!--<meta http-equiv="refresh" content="5;url=http://www.google.com">--></head><body><?php//echo "<meta http-equiv='refresh' content='5;url=http://www.google.com'>"; header("Location:http://www.google.com");?></body></html> Link to comment Share on other sites More sharing options...
jlhaslip Posted March 21, 2009 Share Posted March 21, 2009 You can have NO output to the Browser before sending a header. Not even a blank space character. Otherwise you receive a "Headers already sent error", just like above. You will need to place the header above the HTML as suggested above. All the html tags in your sample is causing the error. See the sample above yours by TKW22. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.