2014-03-13 83 views
0

大家好,晚上我想獲得一些關於這個代碼的幫助,我嘗試了(我的頭先php & Mysql回家:)反正我一直試圖找到問題,但似乎,我我沒有關閉主題標籤,我不知道要做什麼。我新來這個。尋求關於Php的幫助

<?php 

$when_it_happend = $_POST['whenithappend']; 

$how_long = $_POST['howlong']; 

$alien = $_POST['alien']; 

$sawdog = $_POST['sawdog']; 

$email = $_POST['email']; 

$other = $_POST['other']; 





    $to = '[email protected]'; 
    $subject = 'Aliens Abducted Me - Abduction Report'; 
    $msg = "$when_it_happend And was gone for $how_long.\n" . 
     "Alien description: $alien\n" . 
     "Was Fang there: $sawdog\n" . 
     "Other comments: $other; 
    mail($to, $subject, $msg, 'From:' . $email); 

echo 'Thanks for submitting the form <br />'; 

echo 'You were abducted' . $when_it_happend; 

echo 'And were gone for' . $how_long . '<br />'; 

echo 'Describe them:' . $alien . '<br />'; 

echo 'Was Fang there?' . $sawdog . '<br />'; 

echo 'Your email adress is' . $email; 

echo 'Anything els you like to add' . $other; 



    ?> 

回答

1

你在這一行沒有關閉報價:

"Other comments: $other; 

嘗試這樣的:

$to = '[email protected]'; 
$subject = 'Aliens Abducted Me - Abduction Report'; 
$msg = "$when_it_happend And was gone for $how_long.\n" . 
    "Alien description: $alien\n" . 
    "Was Fang there: $sawdog\n" . 
    "Other comments: $other"; 
mail($to, $subject, $msg, 'From:' . $email); 
+1

我沒有看到區別,你能否解釋請 – Edgardasun

+0

看到我的更新回答 –

+0

非常感謝你現在正在工作,但當我嘗試測試發送電子郵件功能我得到這個。警告:電子郵件():無法連接在本地主機"端口" 25至郵件服務器,驗證您的" SMTP "和" SMTP_PORT "設置在php.ini或C使用的ini_set():\ WAMP \ WWW \ report.php上線34 – Edgardasun

1
$to = '[email protected]'; 

$subject = 'Aliens Abducted Me - Abduction Report'; 
$msg = "$when_it_happend And was gone for $how_long.\n" . "Alien description: $alien\n" . "Was Fang there: $sawdog\n" . 
"Other comments: $other"; 
mail($to, $subject, $msg, 'From:' . $email); 

錯誤:$味精沒有關閉。它需要一個「;後$其他

+0

非常感謝您 – Edgardasun

+0

如果這幫助您檢測問題,請接受我的答案,它會幫助我很多:D – Beardminator