Form_submit won't perform action

132 Views Asked by At

Been working on this form for a while and I had it working properly. But I then re-did the form using the form helper in CodeIgniter and now when I click the submit button does nothing. Not even a refresh. I've tested my controller so I'm stuck for what it could be.

<?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);
    }

1

There are 1 best solutions below

3
Tooba On
        $forname = array(
      'name'        => 'forname',
      'id'          => 'forname',
      'value'       => '',
    );


     echo form_input('Forename');