0
我試圖將提交時發送到我的電子郵件的所有數據輸入到我的網站上,但似乎無法使其工作。 ..無法將我的表單數據發送到我的電子郵件
這是我email.php文件..
<?php
$EmailFrom = "[email protected]";
$EmailTo = " [email protected]";
$Subject = "online form message";
$Name = Trim(stripslashes($_POST['name']));
$Email = Trim(stripslashes($_POST['email']));
$Message = Trim(stripslashes($_POST['feedback']));
// validation
$validationOK=true;
if (!$validationOK) {
echo "please check your details";
header("");
exit;
}
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "Thankyou"
}
?>
我的HTML代碼...
<form name="contactform" method="post" action="emailphp.php">
<table width="450px">
<tr>
<td valign="top">
<label for="name">Name *</label>
</td>
<td valign="top">
<input type="text" name="Name" maxlength="50" size="30">
</td>
</tr>
<tr>
<td valign="top"">
<label for="email">Email *</label>
</td>
<td valign="top">
<input type="text" name="Email" maxlength="50" size="30">
</td>
</tr>
<tr>
<td valign="top">
<label for="feedback">Feedback *</label>
</td>
<td valign="top">
<input type="text" name="Feedback" maxlength="150" size="30">
</td>
</tr>
<tr>
<td colspan="2" style="text-align:center">
<input type="submit" value="Submit">
</td>
</tr>
</table>
</form>
當我測試了一下,之後我在表單中輸入一些數據並提交它只是在瀏覽器中顯示php代碼。
你的表單開始標記在哪裏? –
「只顯示PHP代碼」???是PHP安裝在您的網絡服務器(和名爲* .php的文件) –