我不知道什么是错误的,目前没有错误,当我去我的建议页,所以我不知道什么是错的,有什么想法?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