I extended my Joomla registration form and added some checkboxes for a question (multiple selections are allowed), using the purchased tutorial on "Build an Extended Userform." All the newly created fields' data go into the jos_users' params. The text field's and radio field's values got inserted into the params just fine. However, regarding the checkboxes, if a user selects more than one checkbox, only the first piece of data gets inserted into the params.
Other checked items are not inserted into the table. Below are the php codes that I used inside the On Submit Code-after sending email box. "subject" is the name of the checkboxes. "position" is the text field. "role" is a radio input.
<?php
$user_id = JRequest::getInt('cf_user_id', 0, 'post');
r
$user =& JFactory::getUser($user_id);
$position = JRequest::getString('position', '', 'post');
$role = JRequest::getString('role', '', 'post');
$subject = JRequest::getString('subject', '', 'post');
$user->setParam('position', $position);
$user->setParam('role', $role);
$user->setParam('subject', $subject);
$user->save();
?>
Below is the html code for the checkboxes:
<div class="form_item">
<div class="form_element cf_checkbox">
<label class="cf_label">Subject areas(please check all that apply):</label>
<br />
<br />
<input value="Elementary Literarcy" title="" class="radio" id="check10" name="subject" type="checkbox" />
<label for="check10" class="check_label">Elementary Literarcy</label>
<br />
<input value="Elementary Math" title="" class="radio" id="check11" name="subject" type="checkbox" />
<label for="check11" class="check_label">Elementary Math</label>
<br />
<input value="Secondary English" title="" class="radio" id="check12" name="subject" type="checkbox" />
<label for="check12" class="check_label">Secondary English</label>
<br />
<input value="Secondary Math" title="" class="radio" id="check13" name="subject" type="checkbox" />
<label for="check13" class="check_label">Secondary Math</label>
<br />
<input value="Secondary History and Social Science" title="" class="radio" id="check14" name="subject" type="checkbox" />
<label for="check14" class="check_label">Secondary History and Social Science</label>
<br />
<input value="Secondary Science" title="" class="radio" id="check15" name="subject" type="checkbox" />
<label for="check15" class="check_label">Secondary Science</label>
<br />
<input value="Music" title="" class="radio" id="check16" name="subject" type="checkbox" />
<label for="check16" class="check_label">Music</label>
<br />
<input value="Art" title="" class="radio" id="check17" name="subject" type="checkbox" />
<label for="check17" class="check_label">Art</label>
<br />
<input value="PE" title="" class="radio" id="check18" name="subject" type="checkbox" />
<label for="check18" class="check_label">PE</label>
<br />
<input value="Special Education" title="" class="radio" id="check19" name="subject" type="checkbox" />
<label for="check19" class="check_label">Special Education</label>
<br />
<input value="Bilingual" title="" class="radio" id="check110" name="subject" type="checkbox" />
<label for="check110" class="check_label">Bilingual</label>
<br />
<input value="World Languages" title="" class="radio" id="check111" name="subject" type="checkbox" />
<label for="check111" class="check_label">World Languages</label>
<br />
<input value="Agriculture" title="" class="radio" id="check112" name="subject" type="checkbox" />
<label for="check112" class="check_label">Agriculture</label>
<br />
<label>other
<input name="other" type="text" id="other" value="" size="30" maxlength="45">
</label>
<br />
</div>
<div class="cfclear"> </div>
</div>
How do I get all the user's selected values from the checkboxes be shown inside the params? The end result should look like this inside the params if the user selected Music and Art as his subject areas:
subject = Music, Art
Thanks,
mov2046