NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP REDIRECT

PaulCheung paulcheung at tiscali.co.uk
Wed Sep 5 08:36:01 EDT 2007


Thanks David, Dan and bz

the missing quote was just a copying error. Using the header('location: 
http://localhost/mainmenu.php');

this is the value of $number_of_records  = 0
Warning: Cannot modify header information - headers already sent by (output 
started at C:\xampp\htdocs\etestform.php:4) in C:\xampp\htdocs\etestform.php 
on line 59

This is the error message the 4 at the end of 
C:\xampp\htdocs\etestform.php:4 - points to script line 4. which is
 <script language="JavaScript" type="text/javascript">

Line 59 is
57      if ($b == 0)
58        {echo 'this is the value of $number_of_records  = ' . 
$number_of_records;
59        header('location: http://localhost/mainmenu.php');}
60        else

Using PseudoCode - Is there anything in PHP that will simply just sayes the 
following

If  $number_of_records == 0
    goto http://www.localhost/mainmenu.php ??

Paul


----- Original Message ----- 
From: <bz-gmort at beezifies.com>
To: "NYPHP Talk" <talk at lists.nyphp.org>
Sent: Wednesday, September 05, 2007 12:58 PM
Subject: Re: [nycphp-talk] PHP REDIRECT


> PaulCheung wrote:
>> .
>> if ($number_of_records == 0)
>>    {$link = "http://localhost/mainmenu.php";}
>>
>> I have also tried
>> header('Location: http://localhost/mainmenu.php);
>
> For the first, I generally find it best to place an "echo $link" first to 
> make sure it is being set to what I think it should be set to.  Than 
> following that with replacing the echo with a meta-refresh and a countdown 
> timer to see if that works, and do the the header call last(since header 
> calls can get blown if you outputted any text before them, and it is easy 
> when working on other peoples code to have:
>
> <?php
> some code ?>
>
> <?php
> some more code
> ?>
>
> The blank space between the two blocks will kill your header call.
>
> For the second, is that truly what you wrote?  Your missing the closing 
> single quote on the line you posted here.
>
>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php 



More information about the talk mailing list