GET/POST Params
To retrieve the POST/GET variables use the miGetParam() or miGetParamDefault() functions.
miGetParam() function will get parameter with given name from the POST or if it does not exists in the POST, the function will try to get it from GET. Note that if parameter doesn't exist in POST or GET the function will throw exception.
miGetParamDefault() behaves like miGetParam with the difference that miGetParamDefault will accept second parameter which is the default value if variable does not exist.
miSetParam() function is used when the application wants to set a variable for later use with miGetParam() and miGetParamDefault().
If you want to check whether variable is present in POST or GET use miHasParam().
* Get parameter and if not exist stop execution
<?php
try {
$parameter = miGetParam('parameter');
print($parameter);
}
catch (miException $exception)
{
exit("'parameter' is not set!");
}
?>
* Get parameter and if not exist assign default value
<?php
$parameter = miGetParamDefault('parameter', 14);
print($parameter)
?>
* Overwrite parameter
<?php
miSetParam('parameter', 18);
?>
* Check if parameter is present
<?php
if (miHasParam('parameter'))
print("'parameter' is set");
else
print("'parameter' is not set");
?>