|
Next: Generating HTML in PHP
GET-POST VariablesAndromeda combines the PHP superglobals $_GET and $_POST into one array. The POST variables are processed first, and then the GET variables are processed, so that a GET will override a POST of the same name. This feature is entirely for the convenience of the programmer so that you do not have to distinguish between these two sources. Unlike many systems, Andromeda does not want to sanitize or in any way modify the data that comes in through POST/GET. There are two reasons for this:
The "no-sanitization" policy runs counter to the default installation of PHP5. By default PHP5 has a setting turned on called magic-quotes-gpc which modifies data. During the processing of GET-POST Variables, Andromeda detects this setting. If the setting is turned on, Andromeda will pass the data through stripslashes() to return it to its original state. However, there is a small chance that this process will not return the exact value originally posted, so if you have a server used exclusively for Andromeda, you should turn off magic_quotes_gpc in PHP.INI. Reading Variables From A RequestYou can pull any value from the current request with the gp function, which takes as its arguments the variable name. You can find out if a variable was posted in by passing the variable name to the gpExists function, which returns true or false. You can capture a family of variables into a row array with the function rowFromGP, which takes as its single argument a string prefix. All variables whose name begins with that prefix will be put into the array that is returned. The key names will have the prefix itself stripped off. You can set the value of a posted variable, to make it look to later code as if it came from the browser, with gpSet. A variable set this way does not go out to the browser, it appears as if it came in on the current request. You can set the value of hidden variables that will go back to the browser with the Hidden function. Writing VariablesYou can set the value of a hidden variable that will go out to the browser with Hidden which takes as its arguments a name and a value. This is not the same as using gpSet, because the former puts a value onto the form that will be sent to the browser, and therefore returned on the next request, while the latter "fakes" the appearance of a variable coming in on the current request. Table of ContentsgpgpExists rowFromGP gpSet gpSetFromArray gpUnset gpUnsetPrefix gpcontrols gpToSession
Next: Generating HTML in PHP
|
