读书人

按照the Django book上面的例子写了一

发布时间: 2013-09-13 21:12:00 作者: rapoo

按照the Django book上面的例子写了一个表单处理程序, 有点问题,帮忙给看看!


<!DOeCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<title>Html Test</title>
<html>
<body>
<br>
<label>phone num</label>
<input type="text" id="phoneNum" name="phoneNum" value="" style="width: 100px"/>
<br>
<form action="." method="Get">
<label for="m">msg</label>
<input type="text" mame="m" value="{{msg|escape}}" style="width: 500">
<input type="submit" name = "send" value="send"class="button" >
</form>
{% if msg %}
<p>{{ msg|escape}</p>
{% else %}
<p>no msg</p>
{% endif %}
</body>
</html>


def hello(request):
msg = request.GET.get("m", "")
return render_to_response("test.html", {"msg", msg})


我想要的执行效果是,我点击send按钮,如果msg框里面有内容, 下面就会显示msg框里面的内容.不然就显示no msg!
但是执行的时候一直都是显示no msg! 而且浏览器地址栏里面也是"http://127.0.0.1:8000/?send=send",而不是http://127.0.0.1:8000/?m=XXX! django 表单
[解决办法]
mame 6characters

读书人网 >perl python

热点推荐