<?php
$var = "sub";
echo $_GET['{$var}'];
?>
i want this working when i called mydomain.com?sub=hii . is there any other way to make this work? I want to use random $var value from my database.
<?php
$var = "sub";
echo $_GET['{$var}'];
?>
i want this working when i called mydomain.com?sub=hii . is there any other way to make this work? I want to use random $var value from my database.
In a cakePHP environment the url usually is
http://domain/controller/action?sub=hii
Why not just using the framework as it is intended to be used - and as its documented: http://book.cakephp.org/2.0/en/controllers/request-response.html#accessing-querystring-parameters
$sub = $this->request->query('sub');
echo $sub // prints "hii"
Assuming you are using a current version of CakePHP. Please always mention the version you are working with to get correct and appropriate answers!