Checkbox array

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
the_last_tamurai
Forum Commoner
Posts: 87
Joined: Wed Feb 28, 2007 8:24 am
Location: cairo
Contact:

Checkbox array

Post by the_last_tamurai »

firt of all , the problem not found in forum's search page

how can I catch the form checkbox array in ZF

I make the well known code like this:

Code: Select all

start loop
<input type="checkbox" name="id[]" value="" />
end loop
and in the controller

Code: Select all

$theID[] 	= trim($post->getAlpha('id[]'));
gives me null array

and if I do that /* without the brackets*/

Code: Select all

$theID[] 	= trim($post->getAlpha('id'));
it gives me an error in noTags() function because it expects second argument (parameter ) as string
mentor
Forum Contributor
Posts: 100
Joined: Sun Mar 11, 2007 11:10 am
Location: Pakistan

Post by mentor »

>>how can I catch the form checkbox array in ZF
what is ZF?

If getAlpha() assumes parameter as string, then there should some other method for arrays.
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

From what I found, Zend_Filter::getAlpha() is an input validation function -- why are you validating checkbox input (not that you shouldn't, but what are you trying to accomplish)?
User avatar
the_last_tamurai
Forum Commoner
Posts: 87
Joined: Wed Feb 28, 2007 8:24 am
Location: cairo
Contact:

Post by the_last_tamurai »

yes thank you
without filtering it's working now
Post Reply