I wanna check required_param('LType',PARAM_ALPHA)
is set or not? How can I do this?
I use this but it it doesn't work correctly:
if(!isset(required_param('LType',PARAM_ALPHA)))
{echo "salaam";exit;}
I wanna check required_param('LType',PARAM_ALPHA)
is set or not? How can I do this?
I use this but it it doesn't work correctly:
if(!isset(required_param('LType',PARAM_ALPHA)))
{echo "salaam";exit;}
required_param means that the parameter must exist (or Moodle will throw an immediate, fatal error).
If the parameter is optional, then use optional_param('name of param', 'default value', PARAM_TEXT) instead. Then you can check to see if this has the 'default value' (I usually use null as the default value).
In either case, isset() does not make sense, as the variable always has a value assigned to it.
You should compare the result of required_param('LType',PARAM_ALPHA)
with the value you spect, instead of using isset. For example:
if(required_param('LType',PARAM_ALPHA) != 'some value'){
echo "salaam";exit;
}
Or:
if(required_param('LType',PARAM_ALPHA) === false){
echo "salaam";exit;
}