Click to See Complete Forum and Search --> : PHP4/Win98/PWS Problem


Anon
08-02-2000, 02:48 PM
Hello,

I'm in the process of learning PHP. I've set up PHP4 on my dev machine currently running Win98. I'm fairly solid with ASP but want the cross platform and open source benefits of PHP.

Set up of PHP4 and mySQL seemed to go fine. Hello World worked fine. However, when I decided to pass some info from one page to another I ran into problems.

The output from the following code doesn't include the parameter passed from a form on the previous page although I'm sure it should.

<?php
echo ("<p>Thankyou " .$FName. "We appreciate your time</p>");
?>

All I get is

Thankyou We appreciate your time.

Any thoughts ? The PHP is obviously being processed. I copied some Wrox code and that does exactly the same i.e. is processed but ignores what I would term the QueryString data.

Dave

Anon
08-03-2000, 05:50 AM
I've now installed Apache and it's the same so I'm assuming the problem is with PHP....

Anon
08-03-2000, 07:16 AM
You can try

$FName = $HTTP_GET_VARS["FName"];


Shang

Anon
08-03-2000, 07:50 AM
Just does the same.....perplexing...

Anon
08-03-2000, 04:50 PM
Running on Apache the problem was fixed by installing PHP3 instead of PHP4. Is this an issue with PHP4 then ?

Anon
08-04-2000, 06:16 AM
PHP4/NT4/IIS4 no this problem.
You can use phpinfo() to see a list of all
of the PHP variables.
It's very useful.

<?php
$HTTP_VARS = array_merge($HTTP_GET_VARS,$HTTP_POST_VARS);
$FName = $HTTP_VARS["FName"];

echo ("<p>Thankyou " .$FName. "We appreciate your time</p>");

phpinfo();
?>

Anon
08-04-2000, 10:33 AM
Check these sections of your php.ini file. They control the HTTP_*_VARS and whether you can take the shortcut using just $fName. I believe I read they were phasing the shortcut out.

register_globals = Off
"Whether or not to register the EGPCS variables as global variables. You may want to turn this off if you don't want to clutter your scripts' global scope with user data. This makes most sense when coupled with track_vars - in which case you can access all of the GPC variables through the $HTTP_*_VARS[], variables."

register_argc_argv = Off
"This directive tells PHP whether to declare the argv&argc variables (that would contain the GET information). If you don't use these variables, you should turn it off for
increased performance"

track_vars = On
"enable the $HTTP_*_VARS[] arrays, where * is one of ENV, POST, GET, COOKIE or SERVER."

Anon
08-04-2000, 11:00 AM
I have just noticed a difference between my PHP3 and PHP4 ini files (as downloaded from php.net) that may be the cause.

PHP3
magic_quotes_gpc = On

PHP4
magic_quotes_gpc = off

I'll go and check.

Anon
08-04-2000, 11:18 AM
If I'd read the ini file notes properly I would have solved this in two seconds flat. Sorry if I've wasted anyones time.....

"; - register_globals = Off
; Global variables are no longer registered for input data (POST, GET, cookies,
; environment and other server variables). Instead of using $foo, you must use
; $HTTP_POST_VARS["foo"], $HTTP_GET_VARS["foo"], $HTTP_COOKIE_VARS["foo"],
; $HTTP_ENV_VARS["foo"] or $HTTP_SERVER_VARS["foo"], depending on which kind
; of input source you're expecting 'foo' to come from.

:-(