Jump to content


Photo

include... not wroking with ?id get method


  • Please log in to reply
3 replies to this topic

#1 karthikeyan_coder

karthikeyan_coder
  • Members
  • PipPipPip
  • Advanced Member
  • 201 posts

Posted 29 September 2006 - 06:00 AM

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
www.karthi.us

#2 ponsho

ponsho
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 29 September 2006 - 06:45 AM

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.

$id = 12;
$banner_file = "banner.php";
include $banner_file;

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
$banner_file = "banner.php";
include $banner_file;

So in the banner file you can get the $_GET["id"] value.

#3 karthikeyan_coder

karthikeyan_coder
  • Members
  • PipPipPip
  • Advanced Member
  • 201 posts

Posted 03 October 2006 - 09:27 PM

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?
www.karthi.us

#4 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 03 October 2006 - 10:41 PM

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.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users