Forums | Mahara Community
02 July 2019, 3:26 AM
I have a small question. Is there a easy way to get the id from the url?
I think the normal $ _GET ['id'] is blocked ...
Is this function?
$groupid = param_integer('id');
02 July 2019, 11:35 AM
Yes if you are wanting to get an integer value from the url you can use:
$id = param_integer('id');
if you are wanting the page to load both in instances with or without an id supplied
$id = param_integer('id', null);
if you are wanting the page to load both in instances with or without an id supplied but want to default to a specific value, eg '27'
$id = param_integer('id', 27);
There are similar options for a string
param_alpha() -- for alpha strings only
param_alphanum() -- for alpha stings and numbers
param_alphanumext() -- for alpha strings / numbers / underscore / dot / dash
param_variable() -- no checking done so not recommended to use
(only use if you can't control the info coming from 3rd party application)
see htdocs/lib/web.php for more info
02 July 2019, 10:22 PM
Thanks for this useful informations!
Now everything is clearer, thank you!!