我使用以下代码发送电子邮件
<?php
if(isset($_POST['submit']))
{
$name = htmlspecialchars($_REQUEST['name']);
$email = htmlspecialchars($_REQUEST['email']);
$mobile = htmlspecialchars($_REQUEST['mobile']);
$company = htmlspecialchars($_REQUEST['company']);
$qty = htmlspecialchars($_REQUEST['qty']);
//$upload = htmlspecialchars($_REQUEST['upload']);
$msg = htmlspecialchars($_REQUEST['msg']);
}
$to="example@gmail.com";
$subject = "Order Information";
$message.= "FirstName: " . $name . "'n";
$message .= "Email: " . $email . "'n";
$message .= "ContactNo: " . $mobile . "'n";
$message .= "Company: " . $company . "'n";
$message .= "Quantity: " . $qty . "'n";
//$message .= "Upoload: " . $upload . "'n";
$msg = "Message: " . $msg . "'n";
if(mail($to, $subject, $message))
{ echo 'thank you'; }
else{ echo 'error';}
?>
它成功发送电子邮件,但电子邮件中的 AIL 字段为:名:电子邮件:联络号码:公司:数量:
请建议代码???
提交值为空.. 试试这个
<input type="submit" name="submit" value="submit" />
或
<input type="hidden" name="submit" value="submit" />
<button type="submit" name="btn">Submit</button>
表单方法必须使用Post示例:
<form method='POST' name='test'>your input n button </form>