Pk19000 Pk19000 - 5 months ago 38
PHP Question

How can I check required_param is set or not in Moodle?

I wanna check

is set or not? How can I do this?
I use this but it it doesn't work correctly:

{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.