|
views中:
<?php
echo form_open('message/addmsg');
?>
<div class="tr"><label for="name">姓名</label><input name="name" type="text" id="name" class="validate[required,minSize[6],maxSize[25]]" /></div>
<div class="tr"><label for="content">内容</label><textarea name="content" id="content" class="validate[required,minSize[5]]"></textarea></div>
<div class="tr"><label> </label>
<?php
$btn = array('type'=>'submit','class'=>'submit','content'=>'提交');
echo form_button($btn);
?>
</div>
<?php
echo form_close();
?>
controllers中:
class Message extends CI_Controller{
function __construct()
{
parent::__construct();
$this->load->helper(array('form','url'));
......
}
function index()
{
......
}
function addmsg(){
$data=array(
'name'=>$this->input->post('name'),
'content'=>$this->input->post('content'),
'posttime'=>time()
);
print_r($data); //输出为Array ( [name] => [content] => [posttime] => 1358411611 )
......
}
...
}
哪里有问题吗?为什么没有获取到post的数据?
|
|