I have a link and on clicking it, a function is called. In that function, I set the href attribute to pass an id variable. If I alert the href value, I see the correct url along with the Id. But in the corresponding function in the controller, If I do an $_GET of that variable Id, I do not get the value. What is the error?
This is my link:
<a href="http://localhost/FormBuilder/reports/export?height=220&width=350" id="export_entries" class="thickbox button" title= "Export" >Export</a>
And the corresponding on click function:
$("#export_entries").click(function() {
$(this).attr("href",$(this).attr("href")+"&id="+formid);
alert($(this).attr("href"));
});
In this alert box,If I click the second link, I get the value as
http://localhost/FormBuilder/reports/export?height=220&width=350&id=2
But In my export function in the controller I do not get the value. The variable formid is empty.
function export()
{
$formid=$_GET['id'];
echo " formid: ".$formid;
$this->set('formid',$formid);
}