Description

Allows you to get or set a specified item in an HTTP-request.

Syntax

returnValue = Inet_QueryParam(Request, ItemName, DefaultValue, NewValue)

Parameters

The Inet_QueryParam() function has the following parameters:

ParametersDescription
Request[in/out] HTTP-request
ItemName[in] name of an item to look for
DefaultValue[in] the value to return if the item name is not found
NewValue[in] if assigned, new value for the item
returnValue[out] value of a specified item (NULL if not found)

Returns

The value of a specified item. If item is not found the value of the DefaultValue parameter will be returned.

Example: Retrieving a Query Parameter

Assume an OECGI call from the browser as shown below:

http://127.0.0.1/cgi-bin/oecgi.exe/INET_OI_XML_DYN?FILENAME=PRODUCTS&FIELDS=DESCRIPTION,UNIT PRICE

The HTTP request, which passes the FILENAME and the FIELDS, with the parameters separated by an ampersand (&), is:

FILENAME=PRODUCTS&FIELDS=DESCRIPTION,UNIT PRICE

In the Inet_OI_XML_DYN() procedure, a call to Inet_QueryParam() to retrieve the field list, as shown below:

Fields = Inet_QueryParam(Request,'FIELDS')

would return, in the Fields variable, the following:

DESCRIPTION, UNIT PRICE

Example: Returning a Default Value

Assume an OECGI call to Inet_OI_XML_DYN(), with no FIELD parameter passed, as shown below:

http://127.0.0.1/cgi-bin/oecgi.exe/INET_OI_XML_DYN

To return DESCRIPTION as the default, call Inet_QueryParam() as shown below:

Fields = Inet_QueryParam(Request,'FIELDS','DESCRIPTION')

Example: Testing from a BASIC+ Program

To test, pass the HTTP request as the first parameter. Thus, the code below:

request = 'FILENAME=PRODUCT&FIELDS=DESCRIPTION, UNIT PRICE'
fields = Inet_QueryParam( request, 'FIELDS')

will return:

DESCRIPTION, UNIT PRICE

Example: Setting A NewValue from a BASIC+ Program

Set the DOC_ID parameter in request using Inet_QueryParam, then call Inet_Repos to return the HTML contained in the DOC_ID. The DOC_ID needs to be defined as HTML repository item.

doc_id = 'INET_WEB_CUST_ENTRY'
retVal = Inet_QueryParam(request,"DOC_ID","",doc_id)
varhtml = Inet_Repos(request)
return varhtml

See also

Inet_Msg()Inet_Repos()Inet_Rlist()Inet_Security()Inet_Trace()

  • No labels