Forum Moderators: coopster

Message Too Old, No Replies

PHP not populating form variables passed through POST or GET

not populating variables through POST or GET

         

mikejson

8:01 pm on Oct 5, 2004 (gmt 0)

10+ Year Member



Hi everyone, I"m running:

Windows Xp SP2
Apache2
PHP5
MySQL4

Everything seems fine and dandy, and I can do scripting on server side, but for some reason I cannot get data from a form to be put into a variable.

I have a simple form in an html page which submits, and in the php script that handles the input, none of the data in the form is going into the variables.

My php.ini file does have all the GPC's in place(ie variable_order, the way they get processed).

Any help would be appreciated.

Birdman

8:25 pm on Oct 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Register_globals is probably turned off, which I think is the default.

Try adding this at the top(or near) of the script:

extract($_POST); // or $_GET

Regards,
Birdman

Added: Or, turn register_globals on in php.ini...Or, refer to the vars as $_POST['var_name'], $_GET['var_name'], etc...

willybfriendly

8:30 pm on Oct 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How are you accessing the variables? Global variables defaults to off. You need to use $_POST[var] and $_GET[var] syntax.

WBF

<edit>Birdman beat me to it. There are all kinds of reasons not to use extract. Learn to code with gobals off.</edit>

mikejson

8:32 pm on Oct 5, 2004 (gmt 0)

10+ Year Member



Thank you very much, I figured it was a setting of some sort, if something I was missing in my script.

Registering the Globals, would that be a security risk of sort?(this is a test environment so it doesn't matter, but I would like to know anyway).

coopster

8:46 pm on Oct 5, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Yes, you can read more about
register_globals
at the PHP web site -- there is a link in this message about Preventing SQL inject commands! [webmasterworld.com]