![]() |
PHP question
How can I use php virtual include to include php file but with some variables passed onto it?
For example: I wanna include the file substract.php but i want it to substract 5 from 19 to do this i have to call substract.php?a=19&b=5 if i call <?php virtual ("substract.php?a=19&b=5"); ?> it just includes substract.php without the variables Help would be highly appreciated |
have you tied including the full URL to the php file?
eg include('"http://www.yourdomain.com/substract.php?a=19&b=5"); Also if the file is just calling a fucntion in subtract.php you can include the file and then call the fucntion in the intial script. eg. include('subtract.php'); subtract(5,6); where subtract is the function within subtract.php |
You want to virtual include it using SSI? Or what do you mean by virtual include?
|
This is what i wanna add to my HTML
PHP Code:
|
if you HTML file isn't being passed at php then they shouldn't work.
If it is then just use the include or require commands. |
Do you use substract.php by itself at some point? If not, why do it like that? Makes no sense.
If you do not use it seperately, just do include('substract.php') and set the 2 variables you want to substract before the include, the substract.php will see all variables your main php sees at the include() point. The other usefull thing really would be using a function instead of an include file. But I am guessing this is just a simple example and what you are trying to do is more complicated. |
if a var is set in the main page where you include the substract.php you can also call it in substract.
Like for example if $A="100" is set in main before you include the substract.php you can call $A in substract. Just as simple as that.. If you set $A after the include it isn't availble in substract.php Otherwise you need to make functions an parse the var through the function like this name_function($A, $B); |
| All times are GMT -7. The time now is 06:43 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123