By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,642 Members | 1,674 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,642 IT Pros & Developers. It's quick & easy.

PHP config(?) problem

P: n/a
I'm trying to learn PHP, and I'm having a strange problem with my local
install on SuSE 9.0. I have a script here:

http://www.little-people-austin.com/~chris/estpop.php

Here, it works fine. When I try to run the same script on my local machine,
however, I always get "0". I tried a little debug code, and none of the
form values carry over into the variables. This happens with other scripts
as well. Scripts with output only (no form variables) work fine. Why would
this be happening?

Chris

chris casey at ev1 dot net
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Chris wrote:
I'm trying to learn PHP, and I'm having a strange problem with my local
install on SuSE 9.0. I have a script here:

http://www.little-people-austin.com/~chris/estpop.php

Here, it works fine. When I try to run the same script on my local
machine, however, I always get "0". I tried a little debug code, and none
of the form values carry over into the variables. This happens with other
scripts as well. Scripts with output only (no form variables) work fine.
Why would this be happening?


I'm guessing you're trying to access the variables using eg $foo when you
should really be using $_POST['foo'] or $_REQUEST['foo'] (and there's also
the $_GET and $_COOKIE arrays).

Depending on the version of PHP these are not available as $_POST, $_GET etc
but instead as $HTTP_POST_VARS, $HTTP_GET_VARS etc. They changed the
behavior in 4.1.0 but are still available in current versions of PHP.

Check out the manual at
http://www.php.net/manual/en/languag...s.external.php for more info.

Chris

--
Chris Hope
The Electric Toolbox - http://www.electrictoolbox.com/
Jul 17 '05 #2

P: n/a
worked fine here. nice script.

"Chris" <ch***@suse.local> wrote in message
news:10*************@corp.supernews.com...
I'm trying to learn PHP, and I'm having a strange problem with my local
install on SuSE 9.0. I have a script here:

http://www.little-people-austin.com/~chris/estpop.php

Here, it works fine. When I try to run the same script on my local
machine,
however, I always get "0". I tried a little debug code, and none of the
form values carry over into the variables. This happens with other scripts
as well. Scripts with output only (no form variables) work fine. Why would
this be happening?

Chris

chris casey at ev1 dot net

Jul 17 '05 #3

P: n/a
Chris wrote:

<snip>

Well, a little digging through the php manual set me straight. I'm using php
4.3.3, while my hosting service is using 4.0.6. The only way I can find to
get my install to act like theirs is to set register_globals = On in the
php.ini file. Either that or hope my hosting service upgrades (virtual
host, not likely).

If anyone has any other ideas, feel free to post.

Thanks to all who replied (or were going to).

Chris
Jul 17 '05 #4

P: n/a
Chris wrote:
Chris wrote:

<snip>

Well, a little digging through the php manual set me straight. I'm using
php 4.3.3, while my hosting service is using 4.0.6. The only way I can
find to get my install to act like theirs is to set register_globals = On
in the php.ini file. Either that or hope my hosting service upgrades
(virtual host, not likely).

If anyone has any other ideas, feel free to post.


Use $HTTP_POST_VARS['foo'] instead of $foo or $_POST['foo'] and it should
work nicely for both versions. Refer to my other post for more details.

You can also change the value of register_globals in your Apache config file
for a particular virtual host, if you're using Apache with the following
directive in a <virtualhost> section:

php_value register_globals 1

Doing this means you can just change the value for this particular
virtualhost if you are developing for more than one on your dev box.

--
Chris Hope
The Electric Toolbox - http://www.electrictoolbox.com/
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.