如果该字段为空,我想在我的联系表的必填字段下方给出一条错误消息。我跟着这个链接
http://stackoverflow.com/questions/11237655/display-form-validation-errors-next-to-each-field
我的代码如下:
发送.php
$error = array(
"name" => "",
"email" => "",
"message" => ""
);
if(empty()$_POST["email"])
$error["email"] = "Email is required!";
if(empty()$_POST["name"])
$error["name"] = "Name is required!";
if(empty()$_POST["message"])
$error["message"] = "Message is required!";
但我收到错误:
Parse error: syntax error, unexpected ')', expecting T_STRING or T_VARIABLE or '$' in send.php on line 20
第 20 行是if(empty()$_POST["email"])
我的代码有什么错误?