1
내 컨트롤러. 내가 선택에서 아무 출원 없어하지만 지금은 출력 가상 필드가 cakephp에서 작동하지 않습니다
<?echo $this->Form->input('intaddressid', array(
'options' => $time,'label'=>false,'empty' => '(Select Information)'
,'class' => 'form-control border_none'
));?>
아래
$times=$this->Time->find('list',array('fields'=>$this->Time->virtualFields['name_price']));
$this->set('time',compact($times));
내가
public $virtualFields = array('name_price' => 'concat(Time.varaddress1, "-", Time.varaddress2)');
내 모델 시간에 라인 아래에 추가 내 CTP 파일입니다. !!
와 나는`가지고 배열()
$ 시간을 에코와 나는
<option>varaddress1,varaddress2</option>
K를 . 감사합니다 thats 모두 var1, var2 값을 표시 할 이제 DB에 두 값을 저장하려면 ...! 지금 데이터베이스에 ID를 저장합니다. 그래서 뭐 할까 ? 감사합니다 :) – newsurt
데이터베이스에 두 값을 저장하려면 컨트롤러 코드를 $ times = $ this-> Time-> find ('list', array ('fields'=> array ('Time.name_price', 'Time.name_price', 'Time.name_price' ')))); –
또는 짧게. 나는 인쇄하고 싶다. 관리자 패널에서 호텔 이름을 선택하십시오. 지금은 id ..thanks를 출력합니다. – newsurt