已经在这个表单上工作了一段时间,我让它正常工作。但是我然后使用CodeIgniter中的表单助手重新填写表单,现在当我单击提交按钮时什么都不做。甚至没有刷新。我已经测试了我的控制器,所以我不知道它可能是什么。
<?php
echo form_open('site/inputWorker');
echo form_label('Forename:', 'Forename');
echo form_input('Forename');
echo "<br>";
echo form_label('Surname:', 'Surname');
echo form_input('Surname');
echo "<br>";
echo form_label('Skill1:', 'Skill1');
echo form_dropdown('Skill1', $skills, 'None');
echo "<br>";
echo form_label('Skill2:', 'Skill2');
echo form_dropdown('Skill2', $skills, 'None');
echo "<br>";
echo form_label('Skill3:', 'Skill3');
echo form_dropdown('Skill3', $skills, 'None');
echo "<br>";
echo form_label('Availability:', 'Availability');
echo form_dropdown('Availability', $availability, 'None');
echo "<br>";
echo form_submit('Add Worker', 'Add Worker');
echo form_close();
?>
//Add a New Worker
public function inputWorker(){
$Forename=$this->input->post('Forename');
$Surname=$this->input->post('Surname');
$Skill1=$this->input->post('Skill1');
$Skill2=$this->input->post('Skill2');
$Skill3=$this->input->post('Skill3');
$Availability=$this->input->post('Availability');
$this->load->model("model_worker");
if($this->model_worker->insert_worker($Forename, $Surname, $Skill1, $Skill2, $Skill3, $Availability)){
$data['msg']="Sucessfully added the worker";
}
else{
$data['msg']="Something went wrong";
}
$this->load->view("view_confirmation", $data);
}
答案 0 :(得分:0)
$forname = array(
'name' => 'forname',
'id' => 'forname',
'value' => '',
);
echo form_input('Forename');