Simple question, please help
Posted: Tue Dec 29, 2009 8:46 am
I have a script to check if a variable exists via GET, if it does it should set a corresponding name to that variable.
varsetfunc.php?t=test
Simple enough? Well nothing appears and my error.log file records:
varsetfunc.php?t=test
Code: Select all
<?php
function varset($getvar, $namevar){
if ( isset($_GET[$getvar]) ) {
$$namevar = $_GET[$getvar];
}
}
varset('t','test');
echo $test;
?>I am unsure why it does this. Any help, direction would be appreciated. Thanks!Undefined variable: test in C:\\www\\htdocs\\internaltest2\\varsetfunc.php