下面的代碼拋出T變量異常在生產線10PHP T變量
//Two Email Lines
$email_to = "[email protected]";
$email_subject = "AUTO: WEB BETA INVITE REQUEST";
//Set equal to email form textbox
$email_form = $_POST["email_text"];
$email_message = "Email: "$email_form"";
//Create email headers
$headers = 'From: '.$email_form."\r\n".
@mail($email_to, $email_subject,$email_message,$headers);
當我更改=「電子郵件:‘$ email_form’」;到變量$ email_form周圍的單引號,它會運行並且不會引發異常。但是,它會發送一封電子郵件,其中會顯示「電子郵件:',」,它將$ email_form變量讀取爲空白,而不是。
表單的HTML代碼如下。
<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="email_text" 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>
感謝您的幫助
$ email_message = 「電子郵件:$ email_form」 ; – mikeds
爲什麼你會壓制'mail()'上的錯誤?我不相信它甚至可以拋出異常!不要壓抑問題,適當地抓住和處理,或修復它們。 – Brad
也是:$ headers ='From:'。$ email_form。「\ r \ n」;總體來說,有一些格式問題/不好的做法 – mikeds