我在Parse error: syntax error, unexpected T_IF
获得if (mail($to, $subject, $body, $header))
我已关闭semi-colons
。我找不到为什么它会出现If
语句
<?php
include('dbconnect.php');
if (isset($_POST['submit']))
{
...
$to = 'sent@sent.com';
$subject = $_POST['Subject'];
$header = 'From:' .$_POST['Email'];
$message =
'New fedback sent by
First Name: '.$_POST['FirstName'].'
Last Name: '.$_POST['LastName'].'
about '.$_POST['Subject'].'
Message: '.$_POST['msg'].'
'
if (mail($to, $subject, $body, $header))
{
}
?>
答案 0 :(得分:2)
您需要关闭$message
作业,例如;
$message =
'New fedback sent by
First Name: '.$_POST['FirstName'].'
Last Name: '.$_POST['LastName'].'
about '.$_POST['Subject'].'
Message: '.$_POST['msg'].'
';
答案 1 :(得分:1)
此:
$message =
'New fedback sent by
First Name: '.$_POST['FirstName'].'
Last Name: '.$_POST['LastName'].'
about '.$_POST['Subject'].'
Message: '.$_POST['msg'].'
'
缺少结束分号;
。你需要关闭它:
$message =
'New fedback sent by
First Name: '.$_POST['FirstName'].'
Last Name: '.$_POST['LastName'].'
about '.$_POST['Subject'].'
Message: '.$_POST['msg'];