Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Redirecting to a url in PHP

Posted on 2000-05-09
6
Medium Priority
?
315 Views
Last Modified: 2010-05-19
Hej,

I would like to redirect from a page to another. I tried to use the html tag
<META HTTP-EQUIV='REFRESH' CONTENT='3; URL=newpage.html'>
but it does not work.

Is there a way to do a redirect in PHP?

Thanks
Stephane
0
Comment
Question by:stephaneeybert
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 1

Accepted Solution

by:
chkassen earned 150 total points
ID: 2793427
Hi

You can redirect with php using the header() function.

Your code should look as this:
header("Location: http://www.php.net");  /* Redirect browser to PHP web site */
exit;  /* Make sure that code below does not get executed when we redirect. */

Greetings
--
chkassen
0
 
LVL 8

Expert Comment

by:us111
ID: 2793583
Easy in PHP

<?
  header("Refresh:3;newpage.html");
?>
0
 

Author Comment

by:stephaneeybert
ID: 2795579
Thanks guys. Who wants the points?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 8

Expert Comment

by:us111
ID: 2795705
I think my comment answers your question
<META HTTP-EQUIV='REFRESH' CONTENT='3; URL=newpage.html'> ... :))

Be careful, before the header function, you musn't stdout something otherwise it won't work.
0
 

Author Comment

by:stephaneeybert
ID: 2820248
Thanks for all your comments.

The only thing new that I got from you guys, is from "chkassen", who tipped me first about the function "header()". Unfortunately, I cannot use this function in my application, because I want to output some warning message for a few seconds before doing the redirection.

The html tag I was using didn't work, because there was a <style> tag and a <div> tag on the same page for a layer. It seems that when there is a layer on a page, the <meta http-equiv> tag cannot be used. One more html bug?

So I removed my layer, and now I can do the redirection using my <meta http-equiv> tag.

But anyway here are the points.

Thanks
0
 

Author Comment

by:stephaneeybert
ID: 2820249
Cheers!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to implement server side field validation and display customized error messages to the client.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question