Faqts : Business : Programming : Shopping For You : PHP : Common Problems : Forms and User Input

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

31 of 33 people (94%) answered Yes
Recently 9 of 10 people (90%) answered Yes

Entry

When I post or get a form it does not assign a variable like $var. I have to use the $HTTP_POST_VARS["var"] array. Any Sugestions?????

Nov 7th, 2000 20:25
Oskar Baginski, Michael De Meo,


Look in the http://www.php.net/manual/html/configuration.html
for following PHP configuration values:
- register_globals 
- track_vars
and you can also read in:
http://www.php.net/manual/html/language.variables.predefined.html#langua
ge.variables.predefined.php

For your need both values should be set to On.
You can check the settings on your server by running following script:
<? phpinfo(); ?>
I have access to my server so I can set them in php.ini file according 
to my needs.

In case you do not have such rights you can try set track_vars on 
script by script bases:
<? php_track_vars ?> 

but I read somewhere on mailing list:
"In those cases you can enable it by putting <?php_track_vars?>; 
on the SECOND LINE of your php file. 
Putting it on a different line will only enable the $HTTP_GET_VARS 
variable, 
not $HTTP_POST_VARS (I did not test what it did to $HTTP_COOKIE_VARS). 
So put it on the SECOND line, if you put it somewhere else you'll only 
have half the solution."

Hopefully it will solve your problems.