我想製作一個表格,將數據發佈到我的電子郵件中。HTML form PHP post to email
我發現下面的代碼,它工作正常,但我沒有從窗體中得到任何電子郵件。
這裏是PHP文件
<?php
// Contact subject
$name ="$name";
// Details
$address="$address";
$id="$id";
$passport="$passport";
$issue="$issue";
$mula="$mula";
$tamat="$tamat";
$tel="$tel";
$select_dd="$select_dd";
$date="$date";
$textarea="$textarea";
$file="$file";
// Mail of sender
$email="$email";
// From
$header="from: $name <$mail>";
// Enter your email address
$to ='[email protected]';
$send_contact=mail($to,$subject,$message,$header);
// Check, if message sent to your email
// display message "We've recived your information"
if($send_contact){
echo "We've recived your contact information";
}
else {
echo "ERROR";
}?>
那麼,你是否定義了'$ subject'和'$ message'?你可能會遇到一個錯誤。 – putvande
erm對不起,你是什麼意思..我只是在5個小時前學習haha –
'mail($ to,$ subject,$ message,$ header);',你只定義了'$ to'和'$ header'。您還需要定義其他2。你5個小時前學過了嗎?你的意思是5小時前開始學習PHP? – putvande