checkbox arrays

berniez 08 Nov, 2010
Hi all, I hope i'm in the right spot. I am having a problem with checkbox arrays, I have spent hours reading and tyring but still cannot get it right. Form all works, email sends but if the checkbox array is empty it actually shows the field name. I have included example code from the form:-
code...............................
<tr class="matrix_row_light">
<td bgcolor="#CCCCCC" class="question">Main position ...top right</td>
<td bgcolor="#CCCCCC"><input type="checkbox" id="check01" name="pos_top_l[]" class="multiple_choice" value="fp250" />$250</td>
<td bgcolor="#CCCCCC"><input type="checkbox" id="check02" name="pos_top_l[]" class="multiple_choice" value="op200" />$200</td>
<td bgcolor="#CCCCCC"><input type="checkbox" id="check03" name="pos_top_l[]" class="multiple_choice" value="all500" />$500</td>
<td bgcolor="#CCCCCC"><label></label></td>
</tr>
email form code..................................
<tr class="matrix_row_light">
<td class="question" bgcolor="#cccccc">Main position ...top right</td>
<td bgcolor="#cccccc">{pos_top_l} <br /></td>
</tr>
<tr class="matrix_row_dark">
<td class="question">Main position ... top larger with short description</td>
<td>{pos_top_lg} <br /></td>
</tr>
<tr class="matrix_row_light">
<td class="question" bgcolor="#cccccc">Main top B</td>
<td bgcolor="#cccccc">{pos_top_r} <br /></td>
</tr>
-------------------------------------------
When I recieve my emails and there is nothing in the array the results show as {pos_top_l}or the next array as (pos_top_r} etc. most annoying as there are 6 sets of arrays.
Can anyone please help with this situation.
Thanks amd have a great day.
GreyHead 08 Nov, 2010
Hi berniea,

In the OnSubmit Before code box please put this code
<?php
$pos_top_l = JRequest::getString('pos_top_l', '', 'post');
JRequest::setVar('pos_top_l', $pos_top_l);
?>

Bob
berniez 10 Nov, 2010
Thanks for the advice it worked a treat, I had to do it to all arrays and checkboxes and problem solved. Thank you very much
This topic is locked and no more replies can be posted.