我敢肯定这是一个简单的忽略,但它在短时间内让我很头疼。
我试图从这个视图发布数据:
<?php
if (!$this->tank_auth->is_logged_in())
{
echo "<a href='index.php/auth/login'>Login</a>";
} else { ?>
<form method="POST" action="create_community">
<label>Community Name: </label><input type="text" name="communityname" value="231"/><br>
<label>Description: </label><br><textarea name="communitydesc"></textarea><br>
<label>Image Location(URL): </label><input type="text" name="imageloc"/><br>
<input type="radio" name="privacy" value="public" /> public<br />
<input type="radio" name="privacy" value="private" /> private<br />
<input type="radio" name="privacy" value="business" /> business<br />
<input type='submit'/>
</form>
<?php }
?>
创建控制器如下:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Create extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->library('tank_auth');
$this->load->library('encrypt');
$this->load->library('session');
$this->load->model('topbar_model');
$this->load->model('left_model');
$this->load->model('right_model');
/*
$this->load->model('right_model');
$this->load->model('left_model');
$this->load->model('topic_model');
*/
$this->load->helper('url');
$this->load->helper('form_helper');
$this->load->helper('form');
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
$this->load->library('security');
$this->load->library('tank_auth');
$this->lang->load('tank_auth');
}
public function index()
{
$this->load->view('create_community');
}
public function create_community()
{
$this->load->view('templates/head');
echo "testing";
print_r($this->input->post());
}
}
create_community 显示“测试”但不显示帖子。我也尝试过发布个人输入内容,但一无所获。
有任何想法吗?