Link to home
Start Free TrialLog in
Avatar of Solutionabc
Solutionabc

asked on

php best way to redirect

Hi,

I was wondering what the best way is to redirect a user after they have submitted a form. currently after submitting the form a user would have to sit at a blank php page.

I need it to redirect after some operations are performed.

whats the best way?

thanks.
ASKER CERTIFIED SOLUTION
Avatar of meagain35
meagain35

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
header('Location', 'http://.../index.php');
You can also use http_redirect() which is more forgiving if you happen to send output out to the page before you redirect.

It is part of the http extension, but if you have pecl or pear installed, pretty simple to add.

http://us2.php.net/manual/en/function.http-redirect.php

pear install pecl_http

http extension included many other powerful functions as well.
Avatar of Solutionabc
Solutionabc

ASKER

What if I do not want to redirect right away and wait about 7 seconds?
PHP offers a "sleep()" function, i.e sleep(7).