Forum Moderators: coopster

Message Too Old, No Replies

why doesn't PHP recognize my URL vars anymore?

         

partha

7:26 pm on Jan 9, 2005 (gmt 0)

10+ Year Member



I have a php page that takes a var in the url, like

page.php?type=stuff

and then it uses the var "type" in an include statement, like

include("../forms/$type.php");

that worked fine on my old comp running AppServ, and it still works fine on my 1&1 host. but now that I got a new comp and installed AppServ and put the same php pages on it, it doesn't work. It now says

Warning: main(../forms/.php): failed to open stream: No such file or directory in
Warning: main(): Failed opening '../forms/.php' for inclusion

indicating that it's not getting the "type" var from the url anymore.

What's going on? and is there a quick fix for this?

Netizen

7:53 pm on Jan 9, 2005 (gmt 0)

10+ Year Member



This is almost certainly because you have installed PHP cleanly and so 'register globals' is off. This has been the default for quite a while now. You can either change your script to use $_GET['type'] or edit your php.ini file and change register_globals variable to 'on' rather than 'off' (or add the line if it is absent).

That should cure the problem.