PHP help
- Started
- Last post
- 27 Responses
- Anarchitect0
//instead of
include('page.php?var=val');//use
$var = val;include('page.php');
also the problem you might have been experienced is the change in recent versions of php regarding global variables: for security reasons they're not accessible immediatelly after form posts and/or url query strings.
you should add this to the beggining of your script to retrieve all $_GET/$_POST vars:
foreach ($_REQUEST as $key => $value) $$key = $value;
- Mimio0
You can use a GET in the include call? something seems wrong with that.
- fifty500
i don't know what that means. i've used includes before, and I've even tried using the includes that have worked for me before but today it's just not working.
- Anarchitect0
include() cannot 'understand' query strings.
make our variable accessible before your include statement.
- fifty500
i've used PHP includes dozens of times before but never ran into a problem with them until today, mysteriously. I did things the way I always do but today I got the same error as Sherman and I'm not adept enough to fix it on my own. Any solutions?
- cosmo0
u can't pass variable in that manner. variables should be accessible to others automatically.
$blog = 1
include ("watever.php");
- pkmlta0
is there a reason you are passing a variable if you plan to include this script in another? once included it should have access to any variables with in the container script.
- sherman
Warning: main(): Failed opening 'blog.php?pg=1' for inclusion (include_path='.:/php/includes... in /var/www/html/_newsite/index.php on line 33
Is there another way to include a file other then
< ? php include("blog.php?pg=1"); ? >