我想設置一個基本的文本框,當按下提交按鈕時,它將電子郵件框的內容發送給我。問題是我不斷收到空白的電子郵件。由於某些原因,PHP代碼不能訪問文本框輸入。PHP沒有從html文本框中獲取文本
//Two Email Lines
$email_to = "[email protected]";
$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>
讓我們澄清一些事情。電子郵件並非完全空白。它的內容是「電子郵件:」,如PHP代碼所述。它一直讀取$ email_form變量爲空。 – Springerdude11
html和php代碼在同一頁? –
不,分開的文件。 php代碼是通過表單元素的action方法訪問的。 – Springerdude11