Hi,
In my cakePHP controller there is an action named saveReport()
where $attribute_ids
is an array holding all the selected attributes obtained from the Ajax post..
function saveReport()
{
echo $this->params['form']['formid'];
echo $this->params['form']['reportTitle'];
echo $this->params['form']['attr'];
$attribute_ids=$this->params['form']['attr'];
$comma_separated = explode(",", $attribute_ids);
for($i=0;$i<15;$i++)
{
echo $comma_separated[$i];
echo " ";
$this->data['Report']['title']=$this->params['form']['reportTitle'];
$this->data['Report']['form_id']=$this->params['form']['formid'];
$this->data['Report']['attr_id']=$comma_separated[$i];
$this->Report->saveAll($this->data);
}
}
how to identify $comma_separated
's length where $comma_separated
is an array so that i can use that in the for loop now i have used as 15 by default...