|
|
Home Developer Manual 11. API Reference mosGetParam |
| mosGetParam |
|
|
|
|
Last reviewed: 17 Nov 2005, Joomla 1.0.3 mosGetParam is a frequently used function in Joomla components and modules. It allows you to easily retrieve the value of a parameter passed from a previous page, for example, from filling in a form or clicking on a link. By default the data returned will be stripped of HTML tags and will have leading and trailing whitespace characters removed. If magic_quotes_gpc is off then mosGetParam will automatically escape single quotes, double quotes, backslashes and nulls by adding a backslash character (unless the _MOS_ALLOWRAW option is used). Note that with magic_quotes_gpc on all entries in $_ENV, $_GET, $_POST, $_REQUEST, $_COOKIE, $_GLOBALS and $_SERVER arrays are automatically escaped by PHP. This behaviour is not overridden by using the _MOS_ALLOWRAW flag. See also magic quotes in the PHP manual. Note that if you intend to store the data returned by a mosGetParam call in a database field then you will need to perform additional database-specific escaping. See database->getEscaped. Syntaxmixed mosGetParam ( array &$arr, string $name [, mixed $default [, int $mask ]] )
Defined inlibraries/joomla/functions.php ExamplesExample 1: A typical use where the parameter 'task' is retrieved from the set of parameters passed in a URL from a previous page. If 'task' is not present then $task will be set to an empty string. // Get task value. $task = mosGetParam( $_GET, 'task' ); echo $task; Example 2: Force an expected integer to be an integer (wth a default value of zero). // Get an integer. $id = intval( mosGetParam( $_REQUEST, 'id', 0 ) ); echo $id; Please report any errors on this page to the Developer Documentation Forum. |
|
| Last Updated ( Tuesday, 03 January 2006 ) |
| < Prev | Next > |
|---|





