HI is it possible to do what i have shown with the 3 php files under? I want
that a variable stored in a another php file like this, and then i want to
get the stored variable  from a 3rd php file. How can i do this, i have
tried it but it does not work. When i get the variable in the 3rd php file
it is empty. It seems like i cant store variable outside the function, and
then use it in other functions in the same php file. Is that true! In JAVA
and C++ this was a piece of cake...
Thanks in advance from a frustrated student from Norway.

--------------
php file called setget.php
<?php
$temp;// I want to use this as a storing variable until i need this value by
calling the getvariable function

function setvariable($subject)// storing the variable temp
{
$temp=$subject;
}

function getvariable()//getting the variable temp with its stored value
which was set by function setvariable
{
return $temp;
}
?>
----------------------------------------------
 php file called set.php
<?php
require("setget.php");
$setvariable="subject";//seting the variable
setvariable($setvariable);//storing a value to the variable in setget.php
?>
-------------------------------------------------------
php file called get.php
<?php
require("setget.php");
$data=getvariable();
print "$data";//gettin what i stored in set.php by calling the function in
setget.php, but it comes out empty
?>
----------------------------------------------------------



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to