| 
 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.)
 
[Back to original message] 
 |