我不知道什麼是錯誤的,目前沒有錯誤,當我去我的建議頁,所以我不知道什麼是錯的,有什麼想法?PHP插入建議到SQL表中
//index.php
<form name="suggestion" action="http://example.com/suggestions.php" method="POST">
<font style="font-family: arial; color:#3f3f3f; font-size:15px;">Provide me with a URL to one or multiple songs that you want on the website!</font> <br><br><input style="width:243px;" type="text" name="suggestion"><br>
<br>
<input value="Submit" type="submit">
</form>
//suggestions.php
<?php
$conn=mysql_connect("localhost", "u611142741_list", "[REDACTED]");
mysql_select_db("u611142741_sugge", $conn);
// If the form has been submitted
$suggestion = mysql_real_escape_string($_POST['suggestion']);
$ip = $_SERVER['REMOTE_ADDR'];
// Build an sql statment to add the student details
$sql="INSERT INTO suggestions
(Suggestion,IP Address) VALUES
('$suggestion','$ip')";
$result = mysql_query($sql,$conn);
// close connection
mysql_close($conn);
?>
您的字段名稱是否真的帶有空格的「IP地址」? – 2014-11-20 18:50:11
確實。 「IP地址」 – user4191887 2014-11-20 18:51:28