我正在尝试设置一个基本文本框,当按下提交按钮时,它会将框的内容通过电子邮件发送给我。问题是我不断收到空白电子邮件。由于某种原因,PHP 代码没有访问文本框输入。
//Two Email Lines
$email_to = "contact@mywebsite.com";
$email_subject = "AUTO: REQUEST";
//Set equal to email form textbox
$email_form = $_POST['e3text'];
$email_message = "Email: " . $email_form . "";
//Create email headers
@mail($email_to, $email_subject,$email_message,$headers);
HTML 如下
<div id="form">
<form method="post" action="Email_Form_Script.php"
enctype="text/plain"
onsubmit="window.open('FormPopUp.html','popup','width=500,height=500,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0');" >
<div>
<input type="text" class="text" name="e3text" id="emailForm"
value="Enter your e-mail address"
onfocus="if(this.value=='Enter your e-mail address') { this.value = '' }"
onblur="if(this.value=='') { this.value = 'Enter your e-mail address' }" />
<input type="hidden" value="" name="email2"/>
<input type="hidden" name="loc" value="en_US"/>
<input type="submit" class="submit" value=""/>
</div>
</form>