02-15-2010, 10:46 PM
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 include('includeFile.php')?var=2 ?>
I am still trying to find solution
02-15-2010, 11:00 PM
I don't think so, but you should wait to hear back from someone more knowledgeable than me. :rolleyes:
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.
02-15-2010, 11:02 PM
I want to use that var variable in includeFile.php file do u understand or not
02-15-2010, 11:03 PM
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"):
$var = 2;
02-16-2010, 01:14 AM
Yup just assign the variable in your code beforehand. If you're wanting to get them to work with $_GET then assign to $_GET
$_GET['var'] = 2;