Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-15-2010, 10:46 PM   PM User | #1
2009old
New Coder

 
Join Date: Dec 2009
Posts: 39
Thanks: 4
Thanked 0 Times in 0 Posts
2009old is an unknown quantity at this point
how can i pass parameters to an include file in php?

how can i pass parameters to an include file in php?

means can we pass like that ? no . Why and what are the other solution

PHP Code:
<?php include('includeFile.php')?var=2 ?>

Advance thanks
I am still trying to find solution
2009old is offline   Reply With Quote
Old 02-15-2010, 11:00 PM   PM User | #2
mOrloff
Regular Coder

 
mOrloff's Avatar
 
Join Date: Nov 2008
Location: The Great Pacific NW, USA
Posts: 421
Thanks: 8
Thanked 6 Times in 6 Posts
mOrloff is an unknown quantity at this point
I don't think so, but you should wait to hear back from someone more knowledgeable than me.

What I'm really interested in, though, is your intention.
What are you trying to achieve?

There really are many ways to solve the same problem, and sharing you goals may reward you with more-helpful answers.

~ Mo
mOrloff is offline   Reply With Quote
Old 02-15-2010, 11:02 PM   PM User | #3
2009old
New Coder

 
Join Date: Dec 2009
Posts: 39
Thanks: 4
Thanked 0 Times in 0 Posts
2009old is an unknown quantity at this point
I want to use that var variable in includeFile.php file do u understand or not
2009old is offline   Reply With Quote
Old 02-15-2010, 11:03 PM   PM User | #4
PappaJohn
Senior Coder

 
Join Date: Apr 2007
Location: Quakertown PA USA
Posts: 1,028
Thanks: 1
Thanked 125 Times in 123 Posts
PappaJohn will become famous soon enough
No, you cannot do that, but then again, you shouldn't have to.

This will accomplish the same thing (assuming the variable in includeFile.php is named "$var"):
PHP Code:
<?php 
    $var 
2;
    include(
'includeFile.php')
?>
__________________
John
PappaJohn is offline   Reply With Quote
Old 02-16-2010, 01:14 AM   PM User | #5
JAY6390
Regular Coder

 
Join Date: Dec 2009
Location: UK
Posts: 495
Thanks: 0
Thanked 58 Times in 58 Posts
JAY6390 is on a distinguished road
Yup just assign the variable in your code beforehand. If you're wanting to get them to work with $_GET then assign to $_GET
PHP Code:
$_GET['var'] = 2
__________________
My site: JayGilford.com
Resources:
PHP Pagination Class | Getting all page links | Handling PHP Errors properly
If you like a users help, show your appreciation with the rep and thanks buttons :)
JAY6390 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:27 PM.


Advertisement
Log in to turn off these ads.