用$_POST变量的有关问题

WBOY
Release: 2016-06-13 13:33:35
Original
792 people have browsed it

用$_POST变量的问题
我写了个小程序,但在用$_POST变量时出现了问题。
第一:$_POST["submit"]好像不起作用,点了click就没反应了。
第二:$_POST["user"],$_POST["title"],$_POST["content"]会报错,一定要加大括号,像这样{$_POST["user"]},{$_POST["title"]},{$_POST["content"]},我不明白为什么。
哪位大大帮忙看一下。

include("conn.php");

if($_POST["submit"])
{
$sql="INSERT INTO message (id,user,title,content,lastdate) " .
  "values ('',{$_POST["user"]},{$_POST["title"]},{$_POST["content"]},now())";
  echo "Success";
  $result = @mysql_query($sql,$conn)or die(mysql_error());
}


?>

 


  user:

  title:

  content:


 


 



------解决方案--------------------
HTML code

<?php if(isset($_POST["submit"]))
{
$sql="INSERT INTO message (id,user,title,content,lastdate) " ."values ('','$_POST[user]','$_POST[title]','$_POST[content]','".time()."')";
echo $sql;
  $result = @mysql_query($sql,$conn)or die(mysql_error());
}


?>

  
Copy after login
user:
title:
content:
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template