I can't seem to find anything on this and I'm quite new to the area, so if I'm missing something easy I appologise in advance.
I'm using joomla 1.6 and I'm trying to read in a series of checkbox values from a db table. i.e. the table would contain colour: red, blue, green, orange etc. for each of the colours I wish to display a checkbox so users can select there favourite colour from the list. Ideally the data would be displayed in a table and each entry would go in a new row. Once the form is complete i wish to save the data back to a table recording user id and colour id (I think I've figured this bit out). Is there an easy way to do this.
I'm using joomla 1.6 and I'm trying to read in a series of checkbox values from a db table. i.e. the table would contain colour: red, blue, green, orange etc. for each of the colours I wish to display a checkbox so users can select there favourite colour from the list. Ideally the data would be displayed in a table and each entry would go in a new row. Once the form is complete i wish to save the data back to a table recording user id and colour id (I think I've figured this bit out). Is there an easy way to do this.
Hi andysmith,
Here's a post that has the code for radio-buttons. It will need some small changes for checkboxes.
Bob
Here's a post that has the code for radio-buttons. It will need some small changes for checkboxes.
Bob
Thanks for getting back to me. I posted the code into a custom element box from the wizard view(I presumed this is what I should do with it). I changed the db section to reflect my db and I get the following error message when I preview it.
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/content/34/7830634/html/components/com_chronoforms/libraries/includes/data_republish.php(24) : eval()'d code on line 26
Any suggestions?
Thanks
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/content/34/7830634/html/components/com_chronoforms/libraries/includes/data_republish.php(24) : eval()'d code on line 26
Any suggestions?
Thanks
Hi andysmith,
There's a typo/error of some kind in line 26 of the Form HTML.
Please take a Form Backup using the icon in the Forms Manager and post it here (as a zipped file) or PM or email it to me and I'll take a closer look.
Bob
There's a typo/error of some kind in line 26 of the Form HTML.
Please take a Form Backup using the icon in the Forms Manager and post it here (as a zipped file) or PM or email it to me and I'll take a closer look.
Bob
Hi andysmith,
There were a few small typos and some CSS that needed fixing to get the display looking reasonable. Here's a version that works in a Custom element
Bob
There were a few small typos and some CSS that needed fixing to get the display looking reasonable. Here's a version that works in a Custom element
<?php
$db =& JFactory::getDBO();
$query = "
SELECT id, title
FROM jos_content
LIMIT 20
";
$db->setQuery($query);
$data = $db->loadObjectList();
$i = 0;
$buttons = array();
foreach ( $data as $d ) {
$buttons[] = "<input value='{$d->id}' title='' class='' id='article{$i}' name='article' type='radio' />
<label style='float:none;' for='article{$i}' class='' >{$d->title}</label>";
$i++;
}
?>
<div class='cfdiv_radiogroup'>
<?php
$break = '<br style="clear:both;" /><span style="display:inline-block; width:150px;"></span>';
echo implode($break, $buttons);
?>
</div>
This is set up to read in article ids & titles so amend the query to read your table.Bob
This topic is locked and no more replies can be posted.