I am having trouble getting the value of a variable which is in a function outside the function...
Example:
function myfunction() {
$name = 'myname';
echo $name;
}
Then I call it...
if (something) {
myfunction();
}
This is echoing $name
, but if I try to echo $name
inside the input value it won't show:
<input type="text" name="name" value="<?php echo $name ?>"
How can I get access to this variable value?