Does anyone know what's wrong with the code below that prevents me from printing in File2.php
the variable $myusername
from File1.php
.
I simply wanna print the variable $myusername
, or if you know any other way of how to pass that variable that would be very helpful for me.
Here is my example:
File1.php
<?php
$myusername=$_POST['myusername'];
function getusername()
{
return $myusername;
}
?>
File2.php
<?php
require_once('File1.php');
getusername();
?>