Jump to content

include... not wroking with ?id get method


karthikeyan_coder

Recommended Posts

banner.php
is 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.php

i 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
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.