Here is a cut down version of my code with the main class and main function
I need to get the value of 'userName' that input by the user to use it inside 'mainFunction', tried making the 'userName' inside 'myForm' global but that didn't get the value out.
can value of 'userName' be available out side 'mainClass' so that I can use it anywhere?
class mainClass {
function myForm() {
echo '<input type="text" value="'.$userName.'" />';
}
}
function mainFunction () {
$myArray = array (
'child_of' => $GLOBALS['userName']
)
}
returnit from a function!?constantinstead ofglobal variablefor your class, if you aren't going to pass marked parameter to the class function