karthikeyan_coder Posted September 29, 2006 Share Posted September 29, 2006 banner.phpis a file which outputs a banner image...if we call banner.php?59 then it will show 59th banner...i want to show banners in index.phpi have this variable $banner_file = "banner.php?59";if i include($banner.php?59); then it is giving an error...i tried $banner_file = "'"."banner.php?id=".$arr."'";echo("$banner_file");output is.. 'banner.php?id=12'still im getting faild to ourput stream...error... please help me Quote Link to comment https://forums.phpfreaks.com/topic/22459-include-not-wroking-with-id-get-method/ Share on other sites More sharing options...
ponsho Posted September 29, 2006 Share Posted September 29, 2006 You cant include the file like that, if you want to send the parameters you can set it before including the file, so when it loads the banner file it will have the id you set it before.[code]$id = 12;$banner_file = "banner.php";include $banner_file;[/code]Another thing you can do its to send the parameters in the main file (where your include the banner file) like this:index.php?id=12[code]$banner_file = "banner.php";include $banner_file;[/code]So in the banner file you can get the $_GET["id"] value. Quote Link to comment https://forums.phpfreaks.com/topic/22459-include-not-wroking-with-id-get-method/#findComment-100696 Share on other sites More sharing options...
karthikeyan_coder Posted October 3, 2006 Author Share Posted October 3, 2006 im not cleard with you... you said i can set it before including file... $id = 12; where you are connecting the $id with $banner_file ??? please clear my doubt.. any other better solution? Quote Link to comment https://forums.phpfreaks.com/topic/22459-include-not-wroking-with-id-get-method/#findComment-103404 Share on other sites More sharing options...
Ninjakreborn Posted October 3, 2006 Share Posted October 3, 2006 technically no, you can put an include anywhere. If there is data above it, it's passed into the include. An include isnothing but a reference. The php engine looks at the include statement, finds the file it's pointing to, and just puts it straight into the page. That's it, if you set a variable before the include, and in the include try to reference it, it works just the same. Quote Link to comment https://forums.phpfreaks.com/topic/22459-include-not-wroking-with-id-get-method/#findComment-103450 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.