协助定制CakePHP表单

时间:2011-11-17 04:52:39

标签: php cakephp cakephp-1.3 cakephp-2.0

我正在以下列方式显示表单:

<?php
echo $this->Form->create('AmazonMatches', array('action' => 'selectMatches'));
echo $this->Form->input('option_id', array('options' => $allAmazonMatches, 'type' => 'radio'));
echo $this->Form->end(__('Submit', true));
?>

$allAmazonMatches = Array ( [1] => B002I0HJZO [2] => B002I0HJzz [3] => B002I0HJccccccccc )

现在,表单显示文本旁边的单选按钮&#34; B002I0HJZO&#34;等等

我想要做的是显示像

这样的网址旁边的单选按钮
http://somewebsite/B002I0HJZO

如何将URL添加到收音机选项?

1 个答案:

答案 0 :(得分:1)

在控制器中修改$allAmazonMatches

$allAmazonMatches = $this->Model->find('list');
foreach($allAmazonMatches as $k => $v) {
    $allAmazonMatches[$k] = 'http://somewebsite/' . $v;
}