php header location nitelik çalışmıyor

0 Cevap php

Ben çevrimiçi bulabilirim tüm tavsiye aşağıdaki rağmen bir başlık yer sorunumuz var. Mailler komut e-posta (ler) gönderir ama bir Line 29 ile ilgili bir 'zaten gönderildi başlıklar' hatası alıyorum {header ("Location: $ thanksURL");} ve onay sayfasına hiçbir yönlendirme. Bunun yerine bir doğrulayıcı mesajı yazdırmak için, çalışır, bu yüzden sunucu sevmiyor başlık yer kodu hakkında bir şey olmalı bir talimatla başlık konumu kodunu değiştirin.

İşte kod:

<?php
ob_start(); 
$to = "msheath@btinternet.com" ; 
$from = $_REQUEST['email'] ; 
$name = $_REQUEST['name'] ; 
$headers = "From: $from"; 
$subject = "Request for Library Document"; 
$thanksURL = "http://www.postalhistory.org.uk/newsite/php/thankyou.php"; //confirmation page
$fields = array(); 
$fields{"name"} = "Name"; 
$fields{"address"} = "Address"; 
$fields{"email"} = "Email"; 
$fields{"tel"} = "Telephone No"; 
$fields{"author1"} = "First Author"; 
$fields{"title1"} = "First Title"; 
$fields{"author2"} = "Second Author"; 
$fields{"title2"} = "Second Title"; 
$body = "I would like to borrow the undermentioned book(s) from the PHS Library:\n\n"; foreach($fields as $a => $b){    $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); } 
$headers2 = "From: The Librarian, Postal History Society"; 
$subject2 = "Thank you for contacting the Postal History Society"; 
$autoreply = "Thank you for your request. Somebody will get back to you as soon as possible, usually within 48 hours.";
if($from == '') {print "You have not entered an email, please go back and try again";} 
else { 
if($name == '') {print "You have not entered a name, please go back and try again";} 
else { 
$send = mail($to, $subject, $body, $headers); 
$send2 = mail($from, $subject2, $autoreply, $headers2); 
if($send) 
{header("Location: $thanksURL");} 
else 
{print "We encountered an error sending your mail, please notify webmaster@YourCompany.com"; } 
}
}
ob_end_flush()
?>

Kendiniz için denemek için http://www.postalhistory.org.uk/newsite/php/library.php git.

Herkes yanlış ne önerebilirsiniz?

Mikrofon

0 Cevap