[FX.php List] PHP question...
Gareth Evans
gareth.evans at schawk.com
Wed Apr 29 08:57:19 MDT 2009
Maybe you can use output buffering to only send the page if $counter >= 1.
ob_start();
... 75% of page ...
$content = ob_get_contents();
ob_end_clean();
if ($counter < 1) {
header("Location: review.php");
} else {
echo $content;
}
--
GARETH EVANS
> From: Bob Patin <bob at patin.com>
> Reply-To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
> Date: Wed, 29 Apr 2009 09:47:07 -0500
> To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
> Subject: [FX.php List] PHP question...
>
> I have a page that loads, and in the body of the code, there's a loop
> that occurs that tries to load in database records if any exist.
> Because of the way the site works, I have to run this loop in the body
> of the page and not at the top, so 75% of the page has already been
> loaded at this point.
>
> What I'd *like* to do is go to the next page if no records are loaded;
> I have a variable that's easy to test, but I can't seem to get what I
> want.
>
> I tried saying this:
>
> if ($counter<1){
> header("Location: review.php");
> }
>
> but for some reason, it doesn't actually send the user to the next
> page. I can test and confirm that the IF statement does validate and
> the code within IS run, but why doesn't it send the user to the next
> page? Is it because a lot of the HTML has already loaded?
>
> If I use an INCLUDE() or REQUIRE(), the top part of this page will
> show on the subsequent page, which is of course not what I want.
>
> Is there another way to redirect after the BODY of a page has already
> started loading?
>
> Thanks,
>
> Bob Patin
>
> Longterm Solutions
> bob at longtermsolutions.com
> 615-333-6858
> http://www.longtermsolutions.com
> iChat: bobpatin
> AIM: longterm1954
> FileMaker 9 Certified Developer
> Member of FileMaker Business Alliance and FileMaker TechNet
> --------------------------
> FileMaker hosting and consulting for all versions of FileMaker
> PHP Full email services Free DNS hosting Colocation Consulting
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
More information about the FX.php_List
mailing list