CGI - web form variables

J. Landman Gay jacque at hyperactivesw.com
Mon Sep 13 14:18:19 EDT 2004


On 9/13/04 10:53 AM, Gregory Lypny wrote:

> Hello everyone,
> 
> Where can I learn about $QUERY_STRING and other variables that are 
> relevant to processing web forms?  I noticed that Jacqueline uses this 
> in her Fiction Search example, and my guess is that it returns the 
> values of form fields that have been typed in by users.

Nope, these are HTTP environment variables, set by the server. Not all 
environment variables are supported by every server; it depends on your 
ISP and what they allow. Environment variables always start with a 
dollar sign and are always available; they automatically become global 
variables when the script starts up. Here is a list of most of them:

<http://www.lib.washington.edu/asp/browser/servar.asp>

To find out which ones your current server supports, run the following 
"echo.mt" script. This lists only those which are supported and 
available to Rev. Create a new cgi text file named "echo.mt" with this 
script in it:

#!revolution

# This MetaTalk script loops over all the environment variables
# set by the server when it runs a CGI application printing out
# its name and value.
on startup
# loop over all of the global variables, getting name and value
   repeat for each item i in the globals
    put i && "=" && value(i) & return after buffer
   end repeat
# write minimal set of HTTP headers to stdout
   read from stdin until empty
   put it after buffer
   put "Content-Type: text/plain" & cr
   put "Content-Length:" && the length of buffer & cr & cr
   put buffer
end startup

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com


More information about the use-livecode mailing list