Posted: Thu Nov 16, 2006 8:36 pm
Why is it bad anyway? Does it effect the PHP script or is it just dirty coding?
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
<?php
// All application logic goes here
$foo = santitize($_GET['input_var']);
$foo = do_some_stuff_to($foo);
// If we want to do a redirect, do it before output is send...
if($foo == false){
// No error here, since there hasn't been any output yet...
header('Location: http://www.someplace.com');
exit;
}
// OK, now that all of our logic is done... now we can send output...
echo $foo;
?>Code: Select all
<?php
incluide("headertemplate.html");
if ($foo == false) {
header("location: blah.php");
} else {
echo "this is the text...";
}
incluide("footertemplate.html");
?>Code: Select all
<?php
if ($foo == false) {
header("location: blah.php");
} else {
$content = "this is the text...";
}
incluide("headertemplate.html");
echo $content;
incluide("footertemplate.html");
?>