我有两个不同的文件处理这个 我有一个post.php文件(url看起来像post.php ?id =(number))处理父消息页面上的表单 p>
< form id =“chardiv”action =“comments.php”method = “post”>
Name:< br>
< input type =“text”name =“mod_name”required>< br>
消息:< br>
< textarea class =' autoExpand' rows ='3'data-min-rows ='3'placeholder ='Auto-Expanding Textarea'name =“topic”required>< / textarea>
< input type =“submit”value =“Submit” >< br>
< / form>
code> pre>
以及html表单发布的第二个文件“comments.php” p>
<?php
require'connect.php';
$ conn = Connect();
$ id =(int)$ _ GET ['id'];
$ comment = $ conn-> real_escape_string($ _ POST ['topic']);
$ date = time();
$ query =“INSERT into anon_comments(post_id,Date,comment)VALUES('”。$ id。“ ','“。$ date。”','“。$ comment。”')“;
$ success = $ conn-> query($ query);
if(!$ success){
die(“无法输入数据:”。$ conn->错误);
}
$ conn-> close();
header('Location:/index.php');
?>
nn处理发布到 数据库 p>
我不确定如何从表单所在页面向数据库发送外键(parent id)。 p>
< 某人可以给予帮助
谢谢! p>