I am building some form validation code and I want to be able to check against different sent methods so I built a lil function to return a string with the proper request method in it, however I cannot get eval to get it to actually give me the value.. Let me show you-
function m($method)
{
switch ($method)
{
case 0: return '$_REQUEST';
case 1: return '$_POST';
case 2: return '$_GET';
}
}
function val_require($name,$method = 1,$msg = "Field Required")
{
$method = form_validation::m($method);
$method = "$method [$name]";
$method = str_replace(' ','',$method);
eval('echo $method;'); = '$REQUEST[$name]'
echo $method; = '$REQUEST[$name]'
echo $_REQUEST[$name]; = 'MyName'
Ok now $method = '$_REQUEST[name]' from the values I sent in. I have tried using echo and assigning the value to another value within "eval" but no luck. Any ideas? Is there another better function to do this with? Thanks for any help.