Function

retrieve

Package: Helper Deprecated: Retrieves an input variable. You can retrieve any parameter of the HTTP request which launched the execution of this page. Copyright: © 2005-2019 PHPBoost License: GNU/GPL-3.0 Author: Regis VIARRE crowkait@phpboost.com Version: PHPBoost 5.2 - last update: 2018 10 26 Since: PHPBoost 3.0 - 2010 01 22 Contributor: Julien BRISWALTER j1.seth@phpboost.com Contributor: Arnaud GENET elenwii@phpboost.com Located at helper/deprecated_helper.inc.php
Parameters summary
integer $var_type <p>The origin of the variable: GET if it's a parameter in the request URL, POST if the variable was in a formulary, COOKIE if the variables come from a cookie and FILES if it's a file.</p>
string $var_name Name of a HTTP variable you want to retrieve.
mixed $default_value The value you want the variable you retrieve has if the HTTP parameter doesn't exist.
string $force_type = NULL <p>Type of the variable you want to retrieve. If you don't use this parameter, the returned variable will have the same type as the default value you imposed. When you force the variable type, a cast operation will be made from string (it's a string in the HTTP request) to the type you choosed. The types you can use are numerous:</p> <ul> <li>TINTEGER to retrieve an integer value.</li> <li>TSTRING to retrieve a string. The HTML code in this string is protected (XSS protection) and the dangerous MySQL characters are escaped. You can use this variable directly in a MySQL query. It you want to use it now without inserting it in a data base, use the stripslashes PHP function.</li> <li>TSTRING_UNCHANGE if you want to retrieve the value of a string without any processing (no quotes escaping and no HTML protection).</li> <li>TSTRING_PARSE if you want to parse the value you retrieved. The HTML code is protected, it parses with the user parser and the quotes are escaped. Ready to be inserted in a MySQL query !</li> <li>TBOOL to retrieve a boolean value.</li> <li>TUNSIGNED_INT if you expect an unsigned integer.</li> <li>TUNSIGNED_DOUBLE to retrieve an unsigned double value.</li> <li>TSTRING_HTML if you don't want to protect the HTML code of the content but you want to escape the quotes.</li> <li>TSTRING_AS_RECEIVED if you want to retrieve the string variable as it was in the HTTP request. </li> <li>TARRAY to retrieve an array. The values it contains aren't processed.</li> <li>TDOUBLE to retrieve a double value</li> <li>TNONE if you want to get the input variable as it has been recieved (the return value will be a string because HTTP parameters are all strings).</li> </ul>
integer $flags = 0 You can change the behaviour of this method: USE_DEFAULT_IF_EMPTY will allow you to retrieve the default value even if the parameter exists but its value is empty (to know if the var is empty, we use the empty() PHP function).
Return value summary
mixed The value of the variable you wanted to retrieve. Its type is either the same as the default value or the type you forced.