GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   PHP question (https://gfy.com/showthread.php?t=287420)

zentz 05-09-2004 07:05 AM

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

Apache_A 05-09-2004 07:13 AM

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

Nathan 05-09-2004 07:15 AM

You want to virtual include it using SSI? Or what do you mean by virtual include?

zentz 05-09-2004 07:20 AM

This is what i wanna add to my HTML
PHP Code:

<?php virtual ("substract.php?a=2&b=3"); ?>

when i do that it includes just the php file

Apache_A 05-09-2004 07:22 AM

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.

Nathan 05-09-2004 07:32 AM

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.

boyw_utr 05-09-2004 07:38 AM

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