用post传不了值,用get就可以, 不知道是为什么 求大神来帮忙

这是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里面传数据也会跳出来,希望有大神能够来帮忙 感激!!!!

qq_佩奇呀_0
浏览 1662回答 2
2回答

书生

 mathod="post"你这里method拼错了,所以没有认你这个设置,所以post没有生效,默认是get

西兰花伟大炮

<!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()的判断
打开App,查看更多内容
随时随地看视频慕课网APP