I have a input box that, when submitted gives a python method a POST (I'm using django). I'd like to have the search term that the user entered so that I can call methods upon it, preferably in string form.
How do I do that?
I have a input box that, when submitted gives a python method a POST (I'm using django). I'd like to have the search term that the user entered so that I can call methods upon it, preferably in string form.
How do I do that?
In your view, you can get POST parameters like this:
def myview(request):
p = request.POST['parameter']
# do something with p
# return http response
request.POST.get("parameter") instead of request.POST["parameter"]. The former does not throw an exception if parameter is not given in the form, the latter does. Since it is related to the user input, invalid inputs should not raise HTTP 500 but handled properly by coder.