0
我有最簡單的數據庫條目,當我點擊「提交」時,它將我帶到我的主目錄,沒有添加到數據庫。我如何修復它以便輸入數據?我沒有任何問題,這樣在使用相同的代碼過去......數據庫查詢重定向到主目錄
<?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>
我知道我的密碼和數據庫名稱是正確的,因爲當我帶走了「形」與「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')");
?>
哇哦。就是這樣。謝謝! –