Pete Bennett wrote:
[color=blue]
> I have some PHP code on my site at
>
>
http://www.london-translations.co.uk/quick-quote.php
>
> Which allow people to get quotes for translation work. When the form
> is submitted control passes to …
>
>
http://www.london-translations.co.uk...te-results.php
>
> And everything is fine. The problem is, people seem to be landing
> directly on
>
>
http://www.london-translations.co.uk...te-results.php
>
> When they do, errors of the following kind appear
>
>
> Warning: Cannot modify header information - headers already sent by
> (output started at
>[/color]
\\nas06ent\domains\l\london-translations.co.uk\user\htdocs\quick-quote-results.php:2)[color=blue]
> in
>[/color]
\\nas06ent\domains\l\london-translations.co.uk\user\htdocs\quick-quote-results.php[color=blue]
> on line 499
>
> Warning: Cannot modify header information - headers already sent by
> (output started at
>[/color]
\\nas06ent\domains\l\london-translations.co.uk\user\htdocs\quick-quote-results.php:2)[color=blue]
> in
>[/color]
\\nas06ent\domains\l\london-translations.co.uk\user\htdocs\quick-quote-results.php[color=blue]
> on line 500
>
> Is there a way in PHP checking that people have come from
>
http://www.london-translations.co.uk/quick-quote.php without throwing
> errors up .. .ideally I'd like them to be automatically sent to
>
http://www.london-translations.co.uk/quick-quote.php but a meaningful
> message would be better than bombing out like now.[/color]
The reason for the errors is that you're trying to send a header to redirect
the user *after* you've already sent output to the browser.
eg you're doing something like this:
print "some output here";
header("Location:
http://www.london-translations.co.uk/quick-quote-results.php");
Because you already sent output with the "some output here" line you can't
then send a header to the browser. So you'll need to rearrange the logic on
the page a bit to ensure all your processing happens first, and all the
output second.
From the error messages you have received, it's telling you the output
started at line 2 in the file and that you've tried to add a header at
499/500.
A really quick and dirty solution to your problem is to add ob_start() to
the beginning of the file. This turns output buffering on which means
nothing will be sent to the browser until you flush the buffer, which won't
happen if you redirect to another page. However, it's best to fix your code
than do this.
--
Chris Hope - The Electric Toolbox -
http://www.electrictoolbox.com/