PDA

View Full Version : Accessing checkboxes in array


DaveS
07-19-2009, 12:38 PM
Hi I'm struggling with the code to access the array that's created after a form has been submitted that contains checkboxes.
I know they are accessible as an array I just can't figure out the code to access them after they been cleaned.



$vbulletin->input->clean_array_gpc('p', array(
'var1' => TYPE_STR,
'var2' => TYPE_STR,
'checkbox' => TYPE_ARRAY
));
$var1 = $vbulletin->GPC['var1'];
$var2 = $vbulletin->GPC['var2'];

What code to access the array?



Can anyone help me I'd be really grateful?

Dismounted
07-20-2009, 06:17 AM
Just access the array?
echo $vbulletin->GPC['checkbox']['foo'];
Also, you should be using a type other than TYPE_ARRAY. For checkboxes, TYPE_ARRAY_BOOL should be appropriate.