On 9/29/06, adamjspooner <[EMAIL PROTECTED]> wrote: > > Adrian, > > I guess what I don't understand is how to use GET and POST...and what > exactly they are GETting and POSTing...and what to name things and how > to get those named things in the view to get to a template. > > I want to learn the basics and apply them. > GET refers to variables included in the URL. Take this example url:
http://example.com/some_url?a=foo&b=bar&c=blah That url has three variables: a, b, and c which contain the values: "foo", "bar" and "blah" respectively. To access those variables in your view: values = request.GET # values == {'a' : ['foo'], 'b' : ['bar'], 'c' : ['blah']} # if you want a single variable rather than a dictionary of all try a = request.GET["a"] # a == ["foo"] # But may want to set a default if the var is missing b = request.GET.get(b, "defaultstring") # b exists so b == "bar" d = request.GET.get(d, "foobar") # d does not exist so d == "foobar" Post works in much the same way, except that it uses values POSTed from an html form rather than a url. For an example see the documentation [1]. In fact, I'd suggest reading that entire page again. [1]: http://www.djangoproject.com/documentation/request_response/#examples > > I understand the "Hello World!" example, but not the PHP connection > one...it's the response part that I'm having trouble with. > Do you mean that you do not understand how to pass the data to the template for display, or something else? -- ---- Waylan Limberg [EMAIL PROTECTED] --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---