<html> <head> <title>formsend</title> </head> <body> <form action="http://localhost/ci/index.php/form" method="post"> <input type="text" name="product"/> <input type="submit" value="送信"/> </form> <p><?=$msg;?> </body> </html>
<?php class Form extends CI_Controller{ function index(){ if($this->input->post('product') != null){ $str='<p>送信内容:'.$this->input->post('product').'</p>'; } else{ $str='<p>メッセージをどうぞ</p>'; } $data=array('msg'=>$str); $this->load->view('form_post',$data); } } ?>
①view
<?=$msg;?>の意味。見慣れない表記でした。②controller
$data=array('msg'=>$str);
$this->load->view('form_post',$data);
表記になれてなくて、意味がよく分かりませんでした。viewのform_postをロードするとは思うのですが、次の&dataとかいきなり出てきてどういうことだろうと思いました。
どなたか解説よろしくお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/03/06 13:52
2017/03/06 14:42
2017/03/06 14:57
2017/03/06 15:06
2017/03/06 16:40