Notice: Undefined offset: 8192 in /home/miphpf/domains/miphpf.com/public_html/includes/common.inc on line 499

Notice: Undefined offset: 8192 in /home/miphpf/domains/miphpf.com/public_html/includes/common.inc on line 506

Warning: Incorrect key file for table './miphpf_miphpfcom/watchdog.MYI'; try to repair it query: INSERT INTO watchdog (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (0, 'php', 'preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/miphpf/domains/miphpf.com/public_html/includes/unicode.inc on line 291.', 2, '', 'http://www.miphpf.com/manual/get_post_params.html', '', '13.59.136.170', 1714185150) in /home/miphpf/domains/miphpf.com/public_html/includes/database.mysql.inc on line 121
GET/POST Params | MIPHPF - Your Open Source RAD PHP Framework
Skip navigation.
Home

GET/POST Params

: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/miphpf/domains/miphpf.com/public_html/includes/unicode.inc on line 291.

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");
?>