这是add.php页面的form表单<form role="form" action="insert.php" mathod="post" enctype="multipart/form-data" > <div class="form-group"> <label>留言主题</label> <input type="text" class="form-control" name="title" /> </div> <div class="form-group"> <label>留言内容</label> <textarea name="content" rows="10" cols="" class="form-control"></textarea> </div> <input type="submit" class="btn btn-default" value="发表" /> </form>这是insert里的<?php header("Content-type:text/html;charset=utf-8"); $title = $_POST['title']; $content = $_POST['content'];?>实在是找不出问题 一直报错 indefined index,我从add.php里面传数据也会跳出来,希望有大神能够来帮忙 感激!!!!
2 回答
西兰花伟大炮
TA贡献376条经验 获得超318个赞
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <div> <form method="post" action="receive.php"> <input type="text" name="username"> <textarea name="desc"></textarea> <button type="submit">提交</button> </form> </div> </body> </html>
<?php header('content-type:text/html,charset-utf8'); $username = $_POST['username']; $desc = $_POST['desc']; var_dump($username); var_dump($desc); ?>
我这样写没错啊,我以前记得遇到过,你加一个isset()的判断
- 2 回答
- 0 关注
- 1697 浏览
添加回答
举报
0/150
提交
取消