CakePHP View謫堺ス Form繝倥Ν繝代シ

繝輔か繝シ繝

<?= $this->Form->create(
(繝「繝繝ォ蜷)/null,
[
“type”=>”file”/”get”/”post”
‘url’ => [
‘controller’ => (繧ウ繝ウ繝医Ο繝シ繝ゥ蜷),
‘action’ => (繧「繧ッ繧キ繝ァ繝ウ蜷),
],
]
)
?>

<?= $this->Form->create(‘test’, [
“type”=>”post”,
‘url’ => [
‘controller’ => ‘testcontroller’,
‘action’ => ‘testaction’,
]
])?>


<?= $this->Form->end() ?>

繝繧ュ繧ケ繝

騾壼クク

<?=$this->Form->text(譁蟄怜) ?>

謖螳壽枚蟄玲焚縺ァ謚懃イ

<?=$this->Form->text->excerpt(譁蟄怜, ‘method’, 譁蟄玲焚, ‘…’) ?>

繝ゥ繝吶Ν

<?=$this->Form->label(name螻樊ァ, 譁蟄怜) ?>

繝繧ュ繧ケ繝医お繝ェ繧「

<?=$this->Form->textarea(
譁蟄怜,
[
‘rows’=>’10’,
‘cols’=>’10’
]
) ?>

繝ゥ繧ク繧ェ繝懊ち繝ウ

<?=$this->Form->radio(
譁蟄怜,
[
[‘text’=>’陦ィ遉コ’, ‘value’=>’1’],
[‘text’=>’髱櫁。ィ遉コ’, ‘value’=>’0’, ‘checked’ => true]
[‘default’ => 1]
]
) ?>

繧サ繝ャ繧ッ繝医懊ャ繧ッ繧ケ

<?= $this->Form->input(譁蟄怜, [
‘type’ => ‘select‘,
‘options’ =>
[
[‘text’=>’1,000蜀’, ‘value’=>’1000’],
[‘text’=>’2,000蜀’, ‘value’=>’2000’],
[‘text’=>’3,000蜀’, ‘value’=>’3000’],
],
遨コ逋ス陦ィ遉コ
‘empty’ => true,
蛻晄悄蛟、
‘default’ => -1,
‘label’ => ”]) ?>

DB蛟、繧定。ィ遉コ

窶サ繧ウ繝ウ繝医Ο繝シ繝ゥ
$this->Test = TableRegistry::get(‘test’);
$test = $this->Test
->find()
->select([‘id’, ‘test_nm’])
->all()
->combine(‘id’, ‘test_nm’)
->toArray();
$this->set(compact(‘test‘));
繝薙Η繝シ
<?= $this->Form->select(
“test”,
$test,
[‘default’=>$test[‘id’]]
)
?>

繝√ぉ繝繧ッ繝懊ャ繧ッ繧ケ

<?= $this->Form->input(‘dl_flg’,
[
‘type’ => ‘checkbox‘,
‘value’ => ‘1’,
‘label’ => ‘繝繧ヲ繝ウ繝ュ繝シ繝’,
‘checked’ => true,
‘hiddenField’ => false
]
); ?>

繝昴せ繝医Μ繝ウ繧ッ

<?= $this->Form->postLink( 譁蟄怜, ‘/繧ウ繝ウ繝医Ο繝シ繝ゥ蜷/繝。繧ス繝繝牙錐’ ) ?>

hidden

<?= $this->Form->hidden(譁蟄怜 , [‘value’ => 123 ]) ?>

繝輔ぃ繧、繝ォ繧「繝繝励Ο繝シ繝

<?=$this->Form->file(譁蟄怜) ?>

豎守畑

繝。繝シ繝ォ繧「繝峨Ξ繧ケ

<?= $this->Form->control(“name”, [‘type’=>’email’, ‘value’=ス, ‘label’=>false, ‘placeholder’=>’sample@sample.com’, ‘required’=>’required’]) ?>

繝代せ繝ッ繝シ繝

<?= $this->Form->control(“name”, [‘type’=>’password’, ‘value’=ス, ‘label’=>false, ‘required’=>’required’]) ?>

SUBMIT

<?=$this->Form->submit() ?>
隍謨ー縺ョSubmit縺ァ蜃ヲ逅繧貞縺代k蝣エ蜷
<?= $this->Form->submit(“邱ィ髮”, [‘name’=>’edit’]) ?>
<?= $this->Form->submit(“蜑企勁”, [‘name’=>’delete’]) ?>
窶サ繧ウ繝ウ繝医Ο繝シ繝ゥ
if (isset($this->request->getData()[‘edit’])) {

}else if (isset($this->request->getData()[‘delete’]) ) {

}

Follow me!

蜑阪ョ險倅コ

CakePHP View謫堺ス