<div>
<h3>Index Page</h3>
<p><?= $message ?></p>
<form method="post" action="/helo/index">
<input type="text" name="text1">
<input type="submit">
</form>
</div>
$str = $this->request->data('text1');
if ($str != null){
……フォーム送信時の処理……
} else {
……通常アクセス時の処理……
}
$変数 = $this->request->is('post');
※リストが表示されない場合
AddBlockなどの広告ブロックツールがONになっているとリストなどが表示されない場合があります。これらのツールをOFFにしてみてください。
<?php namespace App\Controller; use App\Controller\AppController; class HeloController extends AppController { public function index() { $str = $this->request->data('text1'); if ($str != null){ $str = $this->request->data['text1']; $this->set('message', 'you typed:' . $str); } else { $this->set('message','please type...'); } } }
<< 前へ | 次へ >> |