每当我在文本框中输入文本时,它都无法正确传输到 PHP。PHP 将输入读取为 null,而实际上,其中有文本。
PHP 代码。
//Two Email Lines
$email_to = "contact@mywebsite.com";
$email_subject = "AUTO: REQUEST";
//Set equal to email form textbox
$email_form = $_POST['email_text'];
$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>
</div>
真的很困惑为什么它不起作用。我不断收到只写“电子邮件:”(电子邮件后没有文字)的空电子邮件。