Only one variable in an array will display.
Posted: Fri Aug 07, 2009 3:49 pm
Hello all, I have an array with four keys and four values in it.
on a separate page I try to display all values:
My problem is that when I try to display any values that have been checked it only displays one value at a time. How can I display the full array of values?
Code: Select all
function prepare_functionality()
{
$this->contents = array('Text' => 'Text',
'Flash' => 'Flash',
'Audio' => 'Audio',
'Video' => 'Video');
}Code: Select all
function process_functionality(&$form)
{
$this->prepare_functionality();
$content = $this->coalesce($form['content']);
if (in_array($content, $this->contents))
$this->setValue('content', $content);
else
$this->addError('content', 'Please make a selection:');
return !$this->isError();
}Code: Select all
<table>
<tr>
<td>Content:</td>
<td>
<?php foreach ($wizard->contents as $b) { ?>
<label><?= $b ?><input name="content" type="checkbox" value="<?= $b ?>"<?php if ($wizard->getValue('content') == $b) { ?> checked="checked"<?php } ?>/></label>
<?php } ?>
</td>
<td>
<?php if ($wizard->isError('content')) { ?>
<?= $wizard->getError('content') ?>
<?php } ?>
</td>
</tr>
</table>Code: Select all
<table><tr>
<td>Content:</td>
<td><?= $wizard->getValue('content') ?></td>
</tr>
</table>