-1
我试图显示一些信息存储在MySQL评论表输入,但我有问题。输入名为enterComment
将数据插入到我的数据库中,并且我希望它重新导向回到showComment
输入。显示来自数据库的记录
HTML:
form action='takedata.php' method='POST'>
<input type='text' id='enterComment' name='enterComment' width='400px' placeholder='Write a comment...'>
<input type='submit' id='combuton' name='comButon' value='Comment!'>
<input type='text' id='showComment' name='showComment'>
</form>
PHP:
<?php include "mysql.php"; ?>
<?php
if (isset($_POST['comButon'])){
$enterComment = strip_tags($_POST['enterComment']);
if($enterComment){
$addComment = mysql_query("INSERT INTO comments(comment) VALUES('$enterComment')");
if($addComment==1)
//INSERT INTO showComment input;
}
}
?>
你的VIEW的代码在哪里? – Hassaan
请阅读关于如何使用PDO或mysqli与数据库建立连接的文章。 –