|
contents intro dyno cgi |
Dyno CGI: Accessing ParametersProbably the very first thing you'll need to do in a CGI is access the parameters that the browser sent to the CGI. As discussed earlier, Dyno CGI handles GET and POST method types the same way. It gets the input data from the correct location, parses and decodes it, and builds a list of input variables for you. You simply need to create a VariableList object and initialize it from the CGI input. You can create the object on the stack as an automatic variable, or you can use new to create it on the heap. On the stack:
On the heap:
Voila. The input has been parsed and broken into variables. Actually, if you find it more convenient, you can use the Dyno CGI function
If you want to get the value of a parameter, just call
If an input variable named "somevariable" exists, your string pointer will point to its value. If it does not exist, it will be an empty string (not null). This usually just makes life easier since you don't have to keep checking for a null string pointer. If you really need to differentiate between an empty string and a non-existent parameter, you can call ExampleSee the |