PHP import request variables

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

PHP : import_request_ variables() function

Description

The import_request_variables() function is used to import GET/POST/Cookie variables into the global scope

Version

(PHP 4 and above)

Syntax

import_request_variables (string_types, prefix ) 

Parameters

Name

Description

Required /
Optional

Type

string_types

Some predefined characters indicating which request variable is to be imported. 'G' or 'g' is used for specifying GET, 'P' or 'p' is used for specifying POST and 'C' or 'c' is used for specifying Cookie variables. Order of occurrence of the characters is important. Suppose you mention 'gp', POST variables will override the GET variables. If you use any other characters besides aforementioned characters, they are discarded.

Required

String

prefix

A string which is added before the name of the imported variable. For example, if you have a post value named 'email' and you supply a prefix 'user', the the imported variable name will be 'user_email'.This is an optional parameter.

Optional

String

 

Return value

TRUE on success or FALSE on failure.

Value Type : Boolean.

Example :

  1.  

  2. import_request_variables("p", "w3r_");  

  3. echo $POST['name'].".......................";  

  4. echo "
    ";  

  5. echo $w3r_name;  

  6. ?>  

  7.  

      

  8.   


  9.   

  10.   

  11.   

  

Output :

.......................