所以,我很无聊,决定尝试制作一个简单的 PHP 表单来发送包含表单数据的电子邮件。但是现在,它不断返回相同的错误,这真的很糟糕。这是表格信息:
<table class="table-1" cellspacing="5">
<tr>
<td><label for=fullname>Full Name</label></td> <td><input type="text" name="fullname" id="fullname" placeholder="First and Last Name" /></td>
</tr>
<tr>
<td><label for=email>Email</label></td> <td><input type="email" name="email" id="email" placeholder="name@something.com" /></td>
</tr>
<tr>
<td><label>Age</label></td>
<td>
<select name="age">
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="160">160</option>
</select>
</td>
</tr>
<tr>
<td><label>Are you a programmer/developer?</label></td>
<td>
<select name="program-q">
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
</td>
</tr>
<tr>
<td><label for=picUrl>Picture?</label></td>
<td><input type="text" name="picUrl" placeholder="URL of your Image" /></td>
</tr>
<tr>
<td><label>Are you an <a href="http://wikipedia.org/wiki/Otaku" target="_blank">Otaku?</a></label></td>
<td><input type="checkbox" name="otaku-yes" /> Yes </td>
</tr>
<tr>
<td><label>Do you like JROCK/JPOP?</label></td>
<td><input type="checkbox" name="jrock-yes" /> <label for=jrock-yes>Heck yeah!</label></td>
</tr>
<tr>
<td><label>Would you dress up like a maid randomly<br /> and call me 'master' all day?</label></td>
<td><input type="checkbox" name="maid-q" /> <label for=maid-q>Why Not? ;D </label></td>
</tr>
<tr>
<td><input type="submit" name="submit" value="Apply Now!" /></td>
</tr>
那部分工作正常,然后这是 PHP:
<?php
$to = "jake@weeshare.ws";
$subject = "New Submission";
$email = $_POST['email'];
$fullname = $_POST['fullname'];
$age = $_POST['age'];
$programmer = $_POST['program-q'];
$picUrl = $_POST['picUrl'];
$otaku = $_POST['otaku-yes'];
$jrock = $_POST['jrock-yes'];
$maid = $_POST['maid-q'];
$headers = "From: $email";
$sent = mail("$to, \n $subject, \n $fullname, \n $age, \n $programmer, \n $picUrl, \n $otaku, \n $jrock, \n $maid);
if ( $sent ) {
echo "Good.";
} else {
echo "Not good.";
}
?>
每次我点击“提交”,这就是它返回的内容。无论我调整了多少次,我的服务器都会不断发送:
解析错误:语法错误,第 15 行 /home/weeshare/public_html/wtf/contact.php 中的意外 T_STRING
关于有什么问题的任何想法?我已经在这几个小时了,但仍然没有任何工作..