import_request_variables() doesn't work???

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I am trying to write a bit of secure code, and am having a lot of
trouble with it.  I'm using PHP 5 with register_globals turned off,
and want to acquire some variables from a form.  Unfortunately,
import_request_variables() seems to be completely inert -- it produces
neither errors nor variables.  I've tried using things like extract
($_REQUEST, "foo_"), to exactly the same (non-)effect.  The only thing
that seems to work is turning register_globals on, which I don't want
to do.  What am I doing wrong?

Here's some test code which, as far as I can tell, ought to work, but
doesn't.  If someone could point out the error of my ways, I'd be most

import_request_variables ('gpc', 'foo_');
print ('You typed: '.$foo_bar.' <br>
    <form action="test.php" method="post">
    Type : <input type="text" name="foo_bar">
    <input type="submit"><br>');



Re: import_request_variables() doesn't work???

Quoted text here. Click to load it

The way you've coded it, you would have to use the variable $foo_foo_bar to
acess $_POST['foo_bar']. The "foo_" prefix that you passed to
import_request_variables() adds to the "foo_" already in the name of the
$_POST variable.

- JP

Site Timeline