Dragonfly getpost | Dragonfly web framework

Parameters and Forms

Dragonfly's lib/request.lsp defines many of the global symbols needed to deal with getting user input from forms, handling file uploads, etc.

Dragonfly includes the PHP-like contexts $GET, $POST, $COOKIES and $FILES for handling user-supplied data.

For example, if we wanted to retrieve the value of the GET parameter "foo", we would write:

($GET "foo")

This box shows the value of "foo":

nil

It's currently nil because no GET parameter "foo" has been set. Click this link to set its value to bar.

For more information on $GET, $POST, $COOKIES and $FILES, see the api.

Same Name Multi-Params

Although it's rare, sometimes it's convenient to generate a request where a single parameter has multiple values, like this:

GET /form.cgi?bar=1&bar=2

However, normally only the last value of bar is accepted. To get the entire list of values append [] to the end of the variable name, like this:

GET /form.cgi?bar[]=1&bar[]=2

($GET "bar[]")
;=> (1 2)

One prominent example is a form that contains a select box that allows multiple selections. Like this one:

Example: Multi-selection form

Select multiple choices by holding down the Shift key and then click Submit.

CONTINUE »

Rendered in 0 milliseconds. Used 84 KB of memory, 59 KB for Lisp Cells.