1.HTML内容
<form action="">
<p>用户名:<input type="text" name="username"></p>
<p>密码:<input type="password" name="pwd"></p>
<p><input type="submit" value="提交"></p>
<hr>
<div>
填入的用户是:{{ username }}<br>
填入的密码明:{{ pwd }}
</div>
</form>
2.程序处理
#coding:utf-8
from django.shortcuts import render,render_to_response
# Create your views here.
from django.http import HttpResponse
def hi(request):
dict = {'username':'', 'pwd':''}
if 'username' in request.GET:
dict['username'] = request.GET.get('username')
if 'pwd' in request.GET:
dict['pwd'] = request.GET.get('pwd')
return render_to_response("index.html",dict)
3.比如我们在表单填入jack,123