CodeCharge Studio

CCGetParam Function (ASP)

Description

Retrieves a value of the GET or POST input parameter. The function first attempts to retrieve the parameter from the GET query string and if no value is returned, then the function checks for a POST input parameter with the same name. If no value is returned by a GET or POST input parameter, the function returns the default value specified in the function call.

Syntax

CCGetParam(ParameterName, DefaultValue)

Return value

String

Parameters

Name Type Description Required
ParameterName String Name of the parameter to retrieve. Yes
DefaulfValue Variant Value to return if parameter is not set. Yes

Example 1

This code would usually be placed in the After Initialize event of a Page.

If NOT IsEmpty(CCGetParam("Logout", Empty)) Then
  CCLogoutUser
  Redirect = "Login.asp"
End If

Example 2

The following code disables record updates if a task is not assigned to the current user. CCGetParam function is used to retrieve the current task id from the GET or POST data being submitted. This code would usually be placed in the Before Update event of a Record form.

Dim current_task
Dim assigned_user
current_task = CCGetParam("task_id", Empty)
assigned_user = CCDLookUp("user_id_assign_to", "tasks", "task_id=" &_
  DBIntranetDB.ToSQL(current_task, ccsInteger),  DBIntranetDB)
if current_task <> 0 and CCGetUserID <> assigned_user Then
  tasks.UpdateAllowed = False
end if

See also:

CCGetFromGet function,
CCGetFromPost function


On-line, printable versions and updates