Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

about import_request_variables

Status
Not open for further replies.

melnet

Programmer
Joined
Jul 8, 2003
Messages
77
Location
HK
hi
localhost/test.php?test=1

<?
import_request_variables(&quot;gp&quot;, &quot;req_&quot;);
echo &quot;test: &quot; . $test;
echo &quot;<br>&quot;;
echo &quot;req_: &quot; . $req_test;
?>

result:

test: 1
req_: 1

test variable still works.import_request_variables is useless?coz i changed test to req_test.

thanks
 
I don't know what you mean by &quot; i changed test to req_test.&quot;

import_request_variables() uses the &quot;prefix&quot; input parameter as a string to prepend on all strings imported. If you access a URL by &quot; then the variable $_GET['test'] will be imported into the global variable space as $req_test.

If, however, you have register_globals set to &quot;on&quot;, PHP will have already imported $_GET['test'] into the global namespace as $test.

As the online manual page states, import_request_variables() is useful if you have register_globals set to &quot;off&quot;.


Want the best answers? Ask the best questions: TANSTAAFL!!
 
My output is as expected...

test:
req_: 1

My guess is that you're using the code in conjunction with register_globals = true, if you want test to stay blank you'll need to turn that off.

-Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top