提交"按钮"不能正常工作,我知道一定是缺少了什么,问题是我不知道是什么…主要思想是插入信息,然后刷新显示在下面的表格中,都在同一个"页面"中,"提交"不保存:)。提前谢谢。
Model中的部分代码:
function create_gei()
{
$data['theyear'] = $this->input->post('theyear');
$data['qty_alumni'] = $this->input->post('qty_alumni');
$data['emanations'] = $this->input->post('emanations');
$data['temperature'] = $this->input->post('temperature');
$this->db->insert("pdc_factor_gei", $data);
}
Controller中的部分代码:
function btn_create_gei()
{
$this->model_gas_consum->create_gei();
$submit = $this->input->post('send');
if($submit=='repeatgei')
{
redirect(current_url("gas_consum/factor_gei/"), 'refresh');
}
else
{
redirect("gas_consum/home_gas/");
}
}
View "button"部分代码:
<?php echo form_open("gas_consum/factor_gei"); ?>
<div class="row">
<div class="col-md-6 text-right">
<button
name="send" value="repeatgei" class="btn" type="submit">
<span class="glyphicon glyphicon-refresh"></span> Save</button>
</div>
<?php echo form_close(); ?>
试试这个
<input type="submit" name="send" value="repeatgei" class="btn">
试试这个,把
<button name="send" value="repeatgei" class="btn" type="submit">
<span class="glyphicon glyphicon-refresh"></span> Save</button>
To this
<?php echo form_submit('send', 'repeatgei', 'class="btn"'); ?>