CalcBuilder Forum

Unable to get url param

User moon_740 2012-10-13 19:27:45

In fields and code section, in php code, I try to get url param, but it doesn't seems to work.
For example : $_SERVER doesn't show param, and $_GET) show the ID of my homepage (instead of the ID of the page where my form is).
How can we get params from url within this php code section ?
NB : url of the page where form is published is index.php?option=com_community&view=groups&task=viewgroup&groupid=24&Itemid=581&lang=fr and I would like to get "groupid" param.

Edited by moon_740 - 13.10.2012 23:44

Moonsoft support 2012-10-14 10:58:04

Hello,

PHP code is executed when Calculate button is cliked, and it uses ajax calls to get results.

So, to get the url where module is loaded you should use in PHP Code:

$url=$_SERVER;

This gives you the complete url. If you want to get one parm you may use this code:

$url=$_SERVER;
$url_query=parse_url($url,PHP_URL_QUERY);
parse_str($url_query,$url_array);
$myparam=$url_array;

and now in $myparam you will see the groipid from the referer url.

Hope this help. Regards,

User moon_740 2012-10-14 19:18:23

It works, nice. Thanks a lot.

...
Support/development

Perfect for small code changes or to correct any bug at your site

Buy now!
...
List Manager

Build different lists for your site

Buy now!