【发布时间】:2016-10-01 04:12:28
【问题描述】:
所以我正在处理 html 中的联系表单并将其链接到 sendmail.php 文件,因为我仍处于早期过程中,我正在测试字段是否为空回显某些东西......什么都没有出现。请检查我的代码,它仍处于早期阶段,恐怕我错过了一些东西:
HTML
<form action="sendmail.php" method="post" >
<table width="101" border="0">
<tr>
<th scope="col">Full Name:</th>
</tr>
<tr>
<th width="95" scope="col"><input type="text" name="name" id="to" placeholder="Full Name" /></th><!-- -->
</tr>
<tr>
<th scope="row">Telephone:</th>
</tr>
<tr>
<th scope="row"><input type="text" name="telephone" id="telephone"placeholder="Telephone" />
</tr>
<tr>
<th scope="row">Subject:</th>
</tr>
<tr>
<th scope="row"><input type="text" name="subject" id="subject" placeholder="Subject" /></th>
</tr>
<tr>
<th scope="row">Message:</th>
</tr>
<tr>
<th scope="row"><textarea name="body" id="body" cols="45" rows="5" placeholder="Message"></textarea></th>
</tr>
<tr>
<th scope="row"> </th>
</tr>
<tr>
<th scope="row"><input type="submit" name="submit" id="submit" value="Submit" /></th>
</tr>
</table>
</form>
PHP
<?php
session_start();
require_once 'libs/phpmailer/PHPMailerAutoload.php/';
$errors = array();
//if values are null echo null values
//in my case i kept null on purpose to see if working
//getting nothing
if(isset($_POST['name'],$_POST['telephone'],$_POST['subject'],$_POST['body']))
{
echo 'Null values';
}
?>
【问题讨论】:
-
那里是否存在您需要的文件?您收到错误消息了吗?