"Zerof" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > You are absolutely right, exit, quits my script, this let me use an independent script to > handle the headers. if used with conditional calls. . > ---- > zerof > ----- > "Comex" <[EMAIL PROTECTED]> escreveu na mensagem > news:[EMAIL PROTECTED] > > <[EMAIL PROTECTED]> > ------------- > > Why? AFAIK, exit quits the script, exactly what you want if you want to redirect. > -----------
Zerof, Comex is absolutely correct. exit() should almost always be used in conjucntion with header("Location: "). I would be interested in learning what "collateral effects" you see when doing so. By any logic exit() should reduce the number of adverse effects when using header() redirects. Consider this example.. <? if($i==10){ header("Location: $nextpage"); } $_SESSION['i'] = $i; ?> If we were to employ this code $i would be set to the session even if header() was called and the user was redirected. PHP does not care that another script has been launched and happily continues to execute this script. Is this really a desirable effect? No.. surely not. Instead what we should do is exit the script after redirecting the user. <? if($i==10) { header("Location: $nextpage"); exit; } $_SESSION['i'] = $i; ?> Now we're safe becuase nothing beyond the header() call is going to execute. Obviously this is an extraordinarily simple example. But most scripts are not so straight forward. If you don't exit after a header redirect you could be causing yourself one hell of a headache. Be wise and have one script running at one time. - Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php