KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: URL parameter list and GET WEB FORM VARIABLES caveat
PRODUCT: 4D | VERSION: 2003.2 | PLATFORM: Mac & Win
Published On: February 19, 2004

Using GET WEB FORM VARIABLES to retrieve HTTP Form POST or GET will store your parameter names and values into its first and second arguments as intended; but, you may also want to pass URL parameters in other ways like hyperlinks.

When passing parameters through a URL and using GET WEB FORM VARIABLES to retrieve values, a simple rule should be followed: always make sure your parameter list is well formed.

For example, specify your URL as

https://mydomain.com/4DCGI?param1=value1&param2=value2

and not

https://mydomain.com/4DCGI?param1&param2=value2

The reason is that 4D considers URL arguments as parameter and value pairs and nothing else. However, it does not work as intuitively as one might think. It first looks to see whether an assignment has been made (if there is an "=" sign), and then it gathers what is on the left side as a parameter and what is on the right side as a value.

Because it does not parse each block being separated by the ampersand "&", 4D will always assume that you will pass a well formed parameter list.

Therefore, 4D will set the parameter name and value arrays for https://mydomain.com/4DCGI?param1&param2=value2&param3=value3 as

nameArray = {param1&param2,param3}
valueArray = {value2,value3}

instead of

nameArray = {param1,param2,param3}
valueArray = {null,value2,value3}

In order for GET WEB FORM VARIABLES to properly fill the arrays, you should specify your URL as:
https://mydomain.com/4DCGI?param1=&param2=value2&param3=value3