Welcome to WebmasterWorld Guest from 126.96.36.199
Am I stuck with needing to use both arguments, or is there any way that I can just use one argument (field), and that the function can then be structured to get the actual value of $field from the script where that value is defined?
Or is there just no way that a function can use variables that are defined in the script (other than as a function argument)?
For example if I have
So the variable color has the value of red. Is there anyway to extract the actual variable name from $color? (I just want the 'color' part) So that I could finally have something like:
$y = "color";
$field_value = $_GLOBALS[$field_name]; // get value of field variable
// sample function action
echo '$'. $field_name .' contains the value: '. $field_value;
// end sample
Now say you have $j, that has the value 5.
"$j contains the value: 5"
I'm confused what the purpose is of the function, but the code above would help you get the variable value with just the variable name alone.