I have a simple form
<form name="input" action="" method="get">
Username: <input type="text" name="user" id = "xxx">
<input type="submit" value="Submit">
</form>
On view.py I want to write a function to get value that user input
def add(request):
if request.method =="POST":
abc=request.args.get('xxx')
return render_to_response('myapp/addtour.html')
But it does not work. Please tell me how to do it in Google App Engine or Django
1: You’re checking for POST while your form uses GET — the if block will never fire.
2:
xxxis an HTML ID – it has nothing to do with GET/POST. The name parameter does. Sorequest.GET.get('user')– not'xxx'