![]() |
PHP problem with include and $_GET
I want make include of a file with variables like:
include("/path/to/file.php?id=xxx"); in file.php i get the id variable with $id=@$_GET["xxx"]; the problem is that variable are not passed.. for $_GET i get a null value.. what can i do to pass the variable id to file.php through include function? |
http://us2.php.net/include/
Look under "Example 16.7. include() through HTTP" when using include() and $_GET you must pull the included file with the complete url. And note that include with $_GET doesn't work with all configurations. |
use file_get_contents - or yeah just use a complete url...
|
$id=@$_GET["xxx"]; <-- should be $_GET["id"] not xxx... but then yah no idea about passing vars to include files...
|
i don't think you grasp the concept of include yet.
Why not just do $id = 'whatever'; include('thefile.php'); then in the 'thefile.php' if($id ... blabla) do some process here ... See an include as if the code would be litterally written where you include the file so if File1.php is $a = 1; $b = 2; include('File2.php'); echo $c; and File2.php is $c = $a + $b; is equal to having a file with $a = 1; $b = 2; $c = $a+$b; echo $c; ... hope you see what I mean... 3am here, tired. |
ok..thanks everyboby
|
Quote:
do something like this: $id='xxx'; include("/path/to/file.php"); then inside file.php just use $id wherever needed... |
All times are GMT -7. The time now is 08:46 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123