|
本帖最后由 wenshengke 于 2010-12-29 16:40 编辑
C:
class Admin extends Controller
{
function __Construct()
{
parent::Controller();
$this->load->model('News_model');
}
function saveNews()
{
$this->News_model->insertNews();
}
function addNews()
{
$this->load->view("admin/addnews");
}
----------------------------------------------------------------------
M:
//保存和编辑新闻
function insertNews()
{
$data = array(
'title' => $this->input->post('title'),
'cid' => $this->input->post('cid'),
'content' => $this->input->post('content'),
'time' => (string) date('Y-m-j'),
);
$this->db->insert('news',$data);
}
------------------------------------------------------------------
v:
<html>
<head>
</head>
<body>
<form acrtion="<?php echo site_url("admin/savenews");?>" method="post" name="news" id="news" >
<table><tr>
<td>标题</td>
<td><input size=50 name="title"/> </td>
</tr>
<tr>
<td>分类</td>
<td><input size=50 name="cid"/> </td>
</tr>
<tr>
<td>内容</td>
<td><input size=50 name="content"/></td>
</tr>
<tr>
<td><input type="submit" value="提交"/></td>
</tr>
</table>
</form>
</body>
</html>
情况:不执行,不抱错,请求大家给予指点谢谢 |
|