在下面的代码中,它应该清除表横幅(它清除了这个横幅),然后在其中插入一条消息(它没有)
这是我的密码,谢谢
<?php
error_reporting(-1);
mysql_connect('localhost', 'username', 'password');
mysql_select_db("induadmi_db");
if($_POST['submit']){
$bannermsg = $_POST['newBanner'];
mysql_query("TRUNCATE `Banner`");
mysql_query("INSERT INTO `Banner` SET Message='$bannermsg'");
}
?>
<html>
<body>
<form method="post">
<input type="text" id="newBanner" name="newBanner' placeholder="Enter Message"/>
<input type="submit" id="submit" name="submit" value="Submit">
</form>
</body>
</html>
这是我顺便得到的错误:
注意:未定义的索引:newBanner-in
/主页/induami/public_html/por/newbanner.php,第5行
最佳答案
这是你在HTML中的错误
<html>
<body>
<form method="post">
<input type="text" id="newBanner" name="newBanner" placeholder="Enter Message"/>
<input type="submit" id="submit" name="submit" value="Submit">
</form>
</body>
</html>
name="newBanner'
是错误name="newBanner"
关于php - 不将消息插入表中,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23147930/