以下代码在第 10 行抛出了一个 T 变量异常
//Two Email Lines
$email_to = "contact@website.com";
$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: "$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>
谢谢您的帮助