hashkash wrote:
> Hi,
> The user selects multiple checkboxes and hits the delete button to
> delete.
> Thats where i get stuck.
> Just to check if i can get the values of the checkboxes i did this.
> My checkbox name is the user id itself.
> function delete()
> {
> $j=1;
> //print_r(($this->params['form']['check']['3']));
> $ids=$this->User->findall('','User.id','','','',0);
> foreach($ids as $lastid)
> $last=$lastid['User']['id'];
> print_r($last);
> while($j<=$last)
> {
> if($this->params['form']['check'][$j] == "on")
> {
> echo "hi";
> }
> $j++;
> }
> }
> It works but i get
> Notice: Undefined offset: 2,
> Notice: Undefined offset: 4, etc.
> I get that notice for checkboxes that i dint select.
> Anyway out of this?
> THanks!
> Kashyap
Do it other way around. You find records for the checkboxes that are
selected. Obviously, you do not want to do anything with the records
that are not selected?? So looked up the users based on the checkboxes
that are selected and you will not get those warnings.
FYI, there is a function isset() in php that lets you check if an
array element is set or not. You need to learn php before you use the
framework. Otherwise such small problems will cause a lot of
frustations for you.
My 2 cents,
Ketan ;-)
www.eClassifieds4U.com - Free Classifieds with Photos
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---