Name

var, var_qs, var_post — get the value of a form variable.

Synopsis

var (get | list | exists | number | all)
var_qs (get | list | exists | number | all)
var_post (get | list | exists | number | all)

Description

The var command retrieves information about GET or POST variables sent to the script via client request. It treats both GET and POST variables the same, regardless of their origin. Note that there are two additional forms of var: var_qs and var_post. These two restrict the retrieval of information to parameters arriving via the querystring (?foo=bar&bee=bop) or POSTing, respectively.

var get ?varname? ??default??
Returns the value of variable varname as a string (even if there are multiple values). If the variable doesn't exist as a GET or POST variable, the ?default? value is returned, otherwise "" - an empty string - is returned.
var list ?varname?
Returns the value of variable varname as a list, one list element per reference. Radiobuttons or multiple selection listboxes are suited widgets which may return list data.
var exists ?varname?
Returns 1 if varname exists, 0 if it doesn't.
var number
Returns the number of variables.
var all
Return a list of variable names and values.

See Example 3, “Variable Access”.