[英]database query redirecting to home directory
I have the simplest database entry that when I hit "submit", it takes me to my home directory and nothing is added to the database. 我有最简单的数据库条目,当我单击“提交”时,它将带我到主目录,而没有任何内容添加到数据库中。 How do I fix it so it inputs the data?
如何修复它以便输入数据? I haven't had any problems like this in the past using the same code...
过去我使用相同的代码没有像这样的任何问题...
<?php
if(isset($_POST['submit'])) {
$text = $_POST['text'];
$link = mysql_connect("localhost", "******", "********") or die("Couldn't make connection.");
@mysql_select_db("*****") or die("Couldn't select database");
mysql_query("INSERT INTO wall (message) VALUES ('$text')");
}
?>
<html>
<form action="post" name="post" id="post">
<input type="text" id="text" name="text"/>
<input type="submit" name="submit" id="submit" value="submit"/>
</form>
</html>
I know my password and database name are correct, because when I take away the "form" and "isset", it uploads no problem every time I reload the page: 我知道我的密码和数据库名称是正确的,因为当我拿走“ form”和“ isset”时,每次重新加载页面时它都不会上传任何问题:
<?php
$link = mysql_connect("localhost", "******", "*******") or die("Couldn't make connection.");
@mysql_select_db("********") or die("Couldn't select database");
mysql_query("INSERT INTO wall (message) VALUES ('test')");
?>
change 更改
<form action="post" name="post" id="post">
to 至
<form method="post" name="post" id="post">
Action is the page you want the form to submit to Method is the type (which defaults to get) 操作是您希望表单提交到的页面,方法是类型(默认为获取)
Your form<> has no method, try this: 您的form <>没有方法,请尝试以下操作:
<form method="post" name="post" id="post">
</form>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.