I want to create a function that checks to see if the parameter passed to it is a registered post_var, and if so, to write it to a global variable of the same name. This is so that I can over-write sess_vars with specified post_vars. I can do it using -
if($POST['name'])
$name = $POST['name'];
but because I need to do it quite often it would be nice to encapsulate it in a function. Something like this, but I don't know how to get it to work.
function check_postvar($input)
{
if($POST['$input'])
{
$input2 = "\$" . $input;
global '$input2';
'$input2' = $POST['$input'];
}
}
Thanks in advance