表单中PHP的错误提示:Notice: Undefined index: submit in D:\wamp\www\bbs\add.php on line 4
来源:互联网 发布:淘宝上手机解锁可靠吗 编辑:程序博客网 时间:2024/05/17 00:01
最近学习php,写留言版的时候,代码如下红字部分,在浏览器中测试却显示错误信息:Notice: Undefined index: submit in D:\wamp\www\bbs\add.php on line 4
<?include("conn.php");if($_POST['submit']){ $sql="insert into message (id,user,title,content,lastdate) values "."('','$_POST[user]','$_POST[title]','$_POST[content]',now())"; }?><form action="add.php" method="post">用户:<input type="text" size="10" name="user" /><br>标题:<input type="text" name="title" /><br/>内容:<textarea name="content"></textarea><br/><input type="submit" name="submit" value="发布留言"/></form>
解决办法是:原因是数组键submit不存在,将代码if($_POST['submit']) 改为if (isset($_POST['submit']))即可
最好的办法:修改配置文件
打开php.ini文件
error_reporting设置:
找到error_reporting=E_ALL
修改为error_reporting=E_ALL & ~E_NOTICE
0 0
- 表单中PHP的错误提示:Notice: Undefined index: submit in D:\wamp\www\bbs\add.php on line 4
- 如何解决 Notice: Undefined index: submit in D:\wamp\www\bbs\add.php on line 9
- Notice: Undefined index: id in E:\wamp\wamp\www\liuyanbanban\modify.php on line 问题
- Notice: Undefined index: user in D:\phpStudy\WWW\js\ls\lsmc\php\add.php on line 9
- 为什么会出现Notice: Undefined index: submit in D:\xampp\htdocs\test.php on line 19
- Notice: Undefined index: submit in D:\.....php on line 2问题
- Undefined index: user in E:\wamp\wamp\www\liuyanbanban\login.php on line 4
- Notice: Use of undefined constant title - assumed 'title' in D:\wamp\www\99Pursey\left.php on line
- Notice: Undefined offset: 4 in d:\...\chaxun\rbora.php on line 96错误方法
- PHP:Notice: Undefined index: submit in
- Notice: Use of undefined constant out - assumed 'out' in D:wampwwwdaoruindex.php on line 4解决办法
- Notice: Undefined variable: data in /var/www/html/bbeden/modoer/ecshop/includes/lib_base.php on line
- Notice: Undefined offset: 1 in D:\\wwwroot\\wr\\askseo\\404.php on line 5
- 如何查找PHP中哪里符合配对有错?syntax error, unexpected $end in D:\wamp\www\index.php on
- PHP出现Notice: Undefined index: act in C:\警告提示
- php提示Notice: Undefined index解决方法
- Notice: Constant CSS_URL already defined in C:\wamp\www\PHP\shop\index.php
- PHP中Notice: Undefined index: sku in 问题解决方案
- 约4万个外国人名,中英对照
- springMVC初步
- Spiral Matrix & Spiral Matrix II & Rotate Image
- Android工程目录
- poll机制分析
- 表单中PHP的错误提示:Notice: Undefined index: submit in D:\wamp\www\bbs\add.php on line 4
- ios开发之实现长按UITableViewCell弹出UIMenuController
- 容器视图控制器的创建(WORKING WITH CUSTOM CONTAINER VIEW CONTROLLERS)
- 载入jQuery库的最佳方法
- VMware10 无法联网的一种解决办法
- 《你必须知道的495个C语言问题》笔记--库函数
- 空间分析:区域分析之基于shapfile的栅格数据统计
- 支持向量机(四)-- 核函数
- 黑马程序员笔记——Java流程控制