Re: php redirect

From: Date: Fri, 26 Jul 2002 15:55:54 +0000
Subject: Re: php redirect
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-109774@lists.php.net to get a copy of this message
You have three common options for a redirect. if you are redirecting BEFORE any HTML is sent to the brower, then PHP's header('Location: myscript.php'); will suit you. And once yopu've been coding for a while, you'll think up ways of evaluating your code so that you CAN make redirects before the first tag (<HTML> or <!DOCTYPE>) are sent to the browser. You can also combine output buffering (ob_start(), etc etc) to work around this. Option 2 is a <META> tag refresh, which may work depending on what your code looks like. I *think* valid HTML pages require the <META> tags to be in the head, although many browsers accept them anywhere. The third option is Javascript, and I'd steer clear from it as much as you can. You don't want to rely on anything client-side (browser-side) unless you absolutely have to... if they don't have JS, then your site breaks. Very un-good!!!! :) Justin > I have a redirect i would like to do using php. It will go something like > this > if (mysql_db_query ($dbname, $query, $link)) { > {redirect would go here} > } else { > {a different location on this redirect here} > > How can i accomplish this? i just do not know php well enough to code the > redirect. Please help. Thanks in advance and for all of the past help.

« previous php.general (#109774) next »