我想从用户那里得到评论,但浏览器说致命错误:函数名称必须是字符串。我的代码;致命错误函数名称必须是字符串
// <form name="form1" method="post" action="posting.php">
// <input name="comment" type="text" id="comment" style="width:254px; height:44px;">
// </form>
<?php
$comment = $_POST('comment');//this was the line where problem occured
if(!empty($comment))
{
mysql_query("INSERT INTO comment (comment) VALUES('".$comment."')");
}
echo "$comment";
?>
而不是$ comment = $ _POST ['comment']我会写$ comment = mysql_real_escape_string($ _ POST ['评论'])。然后当你显示它时,确保你可以把它包装在htmlentities()方法中。可能这是不够的,但总比没有好 – mkk