<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >import_request_variables</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="Manual do PHP" HREF="index.html"><LINK REL="UP" TITLE="Variáveis, Funções" HREF="ref.variables.html"><LINK REL="PREVIOUS" TITLE="gettype" HREF="function.gettype.html"><LINK REL="NEXT" TITLE="intval" HREF="function.intval.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Manual do PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.gettype.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.intval.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.import-request-variables" ></A >import_request_variables</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN229718" ></A ><P > (PHP 4 >= 4.1.0, PHP 5)</P >import_request_variables -- Import GET/POST/Cookie variables into the global scope</DIV ><DIV CLASS="refsect1" ><A NAME="AEN229721" ></A ><H2 >Description</H2 >bool <B CLASS="methodname" >import_request_variables</B > ( string types [, string prefix] )<BR ></BR ><P > Imports GET/POST/Cookie variables into the global scope. It is useful if you disabled <A HREF="ini.core.html#ini.register-globals" >register_globals</A >, but would like to see some variables in the global scope. </P ><P > Using the <CODE CLASS="parameter" >types</CODE > parameter, you can specify which request variables to import. You can use 'G', 'P' and 'C' characters respectively for GET, POST and Cookie. These characters are not case sensitive, so you can also use any combination of 'g', 'p' and 'c'. POST includes the POST uploaded file information. Note that the order of the letters matters, as when using "gp", the POST variables will overwrite GET variables with the same name. Any other letters than GPC are discarded. </P ><P > The <CODE CLASS="parameter" >prefix</CODE > parameter is used as a variable name prefix, prepended before all variable's name imported into the global scope. So if you have a GET value named "userid", and provide a prefix "pref_", then you'll get a global variable named $pref_userid. </P ><P > If you're interested in importing other variables into the global scope, such as SERVER, consider using <A HREF="function.extract.html" ><B CLASS="function" >extract()</B ></A >. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Nota: </B > Although the <CODE CLASS="parameter" >prefix</CODE > parameter is optional, you will get an <A HREF="phpdevel-errors.html#internal.e-notice" >E_NOTICE</A > level error if you specify no prefix, or specify an empty string as a prefix. This is a possible security hazard. Notice level errors are not displayed using the default <A HREF="ref.errorfunc.html#ini.error-reporting" >error reporting</A > level. </P ></BLOCKQUOTE ></DIV ><DIV CLASS="informalexample" ><P ></P ><A NAME="AEN229745" ></A ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br /></font><font color="#FF8000">// This will import GET and POST vars<br />// with an "rvar_" prefix<br /></font><font color="#0000BB">import_request_variables</font><font color="#007700">(</font><font color="#DD0000">"gP"</font><font color="#007700">, </font><font color="#DD0000">"rvar_"</font><font color="#007700">);<br /><br />echo </font><font color="#0000BB">$rvar_foo</font><font color="#007700">;<br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ><P ></P ></DIV ><P > See also <A HREF="reserved.variables.html#reserved.variables.request" >$_REQUEST</A >, <A HREF="ini.core.html#ini.register-globals" >register_globals</A >, <A HREF="language.variables.predefined.html" >Predefined Variables</A >, and <A HREF="function.extract.html" ><B CLASS="function" >extract()</B ></A >. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.gettype.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Principal</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.intval.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >gettype</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.variables.html" ACCESSKEY="U" >Acima</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >intval</TD ></TR ></TABLE ></DIV ></BODY ></HTML >