You are here: Re: PHP Redirect « PHP Programming Language « IT news, forums, messages
Re: PHP Redirect

Posted by Petr Vileta on 01/16/07 08:42

"Arjen" <dont@mail.me> píse v diskusním príspevku
news:eohv3v$nbl$1@brutus.eur.nl...
> Michael Fesser schreef:
>> .oO(John)
>>
>>> I have a php contact script and I want it to redirect to my homepage
>>> without using the standard header command.
>>>
>>>
>>> <?php
>>> header("location:http://www.johndoe.com/index.html");
>>> exit;
>>> ?>
>>
>> That's the correct way. What's wrong with it?
>>
>> Micha
>
> I'm guessing headers allready sent error.
>
> If op could show some code it would be clear :-)
>
Because header must be send BEFORE anything other. Sample code

<?php
if( some condition) {
header("Location: www.google.com"); }
else {
// read some from database }
// read or set session
?>
<html><head>
.....

--

Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация