似乎是浏览器问题,因为在Firefox中它工作正常,但没有在Chrome中。Mysql在插入数据后插入空行(在Chrome中)
为什么当我提交我的PHP表单插入数据到MySQL数据库表中,然后检查表。我看到我新创建的行中有数据,还有一行没有任何内容?
我的控制器:
function Admin() {
parent::Controller();
$this->dx_auth->check_uri_permissions();
$this->load->model('alert_model');
$data['rows'] = $this->alert_model->check($num_results=4);
$this->load->view('includes/header', $data);
}
function index() {
$this->load->view('admin/notifications');
$this->load->view('includes/footer');
}
function sendalert() {
$info = array(
'msg_author' => $this->input->post('msg_author'),
'msg_date' => $this->input->post('msg_date'),
'msg_subject' => $this->input->post('msg_subject'),
'msg_content' => $this->input->post('msg_content')
);
$this->send_notification->send($info);
$this->index();
}
我的模型:
function send($info) {
$this->db->insert('msg', $info);
return;
}
笔者认为:
<?php echo form_open('admin/sendalert'); ?>
<label for="msg_subject">Subject</label>
<input type="text" name="msg_subject" id="msg_subject" />
<label for="msg_date">Date</label>
<input type="text" name="msg_date" id="msg_date" />
<label for="msg_author">From</label>
<input type="text" name="msg_author" id="msg_author" />
<label for="msg_content">Content</label>
<input type="text" name="msg_content" id="msg_content" />
<input type="submit" value="submit" />
<?php echo form_close(); ?>
谢谢
它真的说'lable'而不是'label'吗? – 2010-12-12 02:32:33
lol nope,我的IDE自动改变这些出于某种原因,并忘记在粘贴之前将它们改回这里 – Elgoog 2010-12-12 02:37:05