原生的html表单在yii中怎么把数据提交到控制器的方法里?
<formaction=""method="post"><inputtype="text"name="product_id"></form>控制器里$_POST["pro...
<form action="" method="post">
<input type="text" name="product_id" >
</form>
控制器里$_POST["product_id"]但是传不到控制器里 展开
<input type="text" name="product_id" >
</form>
控制器里$_POST["product_id"]但是传不到控制器里 展开
2个回答
2015-05-08
展开全部
//如果不用Criteria,也可以直接写condition语句(findAll要保持一样,但是offset和limit就要自己计算了),例如
//$count = Mymodel::model()->count("uid=:uid", array("uid"=>intval($_GET["uid"])));
//处理分页
$count = Mymodel::model()->count($criteria);
$pages = new CPagination($count);
$pages->pageSize = 20;
$pages->applyLimit($criteria);
//获取数据
$data = Mymodel::model()->findAll($criteria);
$this->render('index', array(
"model" => $mymodel,//下面的片段模板将不使用
"pages" => $pages,
"data" => $data,
));
}
//in template,直接遍历$data,元素是Mymodel对象实例,用->访问属性即可
<table class="list">
<?php foreach($data as $item){ ?>
<tr>
<td><?php echo $item->id; ?></td>
<td><?php echo $item->name; ?></td>
<td><?php echo $item->age; ?></td>
<td><?php echo $item->gender; ?></td>
</tr>
<?php } ?>
</table>
<ul class="page">
<?php
//$count = Mymodel::model()->count("uid=:uid", array("uid"=>intval($_GET["uid"])));
//处理分页
$count = Mymodel::model()->count($criteria);
$pages = new CPagination($count);
$pages->pageSize = 20;
$pages->applyLimit($criteria);
//获取数据
$data = Mymodel::model()->findAll($criteria);
$this->render('index', array(
"model" => $mymodel,//下面的片段模板将不使用
"pages" => $pages,
"data" => $data,
));
}
//in template,直接遍历$data,元素是Mymodel对象实例,用->访问属性即可
<table class="list">
<?php foreach($data as $item){ ?>
<tr>
<td><?php echo $item->id; ?></td>
<td><?php echo $item->name; ?></td>
<td><?php echo $item->age; ?></td>
<td><?php echo $item->gender; ?></td>
</tr>
<?php } ?>
</table>
<ul class="page">
<?php
展开全部
//如果不用Criteria,也可以直接写condition语句(findAll要保持一样,但是offset和limit就要自己计算了),例如
//$count = Mymodel::model()->count("uid=:uid", array("uid"=>intval($_GET["uid"])));
//处理分页
$count = Mymodel::model()->count($criteria);
$pages = new CPagination($count);
$pages->pageSize = 20;
$pages->applyLimit($criteria);
//获取数据
$data = Mymodel::model()->findAll($criteria);
$this->render('index', array(
"model" => $mymodel,//下面的片段模板将不使用
"pages" => $pages,
"data" => $data,
));
}
//in template,直接遍历$data,元素是Mymodel对象实例,用->访问属性即可
<table class="list">
<?php foreach($data as $item){ ?>
<tr>
<td><?php echo $item->id; ?></td>
<td><?php echo $item->name; ?></td>
<td><?php echo $item->age; ?></td>
<td><?php echo $item->gender; ?></td>
</tr>
<?php } ?>
</table>
<ul class="page">
//$count = Mymodel::model()->count("uid=:uid", array("uid"=>intval($_GET["uid"])));
//处理分页
$count = Mymodel::model()->count($criteria);
$pages = new CPagination($count);
$pages->pageSize = 20;
$pages->applyLimit($criteria);
//获取数据
$data = Mymodel::model()->findAll($criteria);
$this->render('index', array(
"model" => $mymodel,//下面的片段模板将不使用
"pages" => $pages,
"data" => $data,
));
}
//in template,直接遍历$data,元素是Mymodel对象实例,用->访问属性即可
<table class="list">
<?php foreach($data as $item){ ?>
<tr>
<td><?php echo $item->id; ?></td>
<td><?php echo $item->name; ?></td>
<td><?php echo $item->age; ?></td>
<td><?php echo $item->gender; ?></td>
</tr>
<?php } ?>
</table>
<ul class="page">
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询