0

I create one form in codeigniter. I don't know what happened.my submit button is not working while i click on submit..

Here is my view code:

<form method="post" action="<?php echo base_url().'Candidate/candidate_process' ?>">

    <b>Date </b>:<input type="text" name="date" id="date"><br><br>

    <div class="form-group">

        <label>Choose  Candidate</label>
        <select class="form-control" name="candidate_id">
            <option value="" disabled selected>Select Candidate</option>

            <?php foreach($candidate as $rows) { ?>
            <option value="<?php echo $rows->candidate_id?>"><?php echo ucfirst($rows->first_name)?></option>
            <?php } ?>

        </select>
    </div><br></br>



    <div class="form-group">

        <label>Choose  Vendor</label>
        <select class="form-control" name="user_id">
            <option value="" disabled selected>Select Vendor</option>

            <?php foreach($usertype as $rows) { ?>
            <option value="<?php echo $rows->user_id?>"><?php echo ucfirst($rows->first_name)?></option>
            <?php } ?>

        </select>
    </div><br></br>


    <div class="form-group">
        <label><b>Select Status:</b></label>
        <select class="form-control" name="status_type_id">
            <option value="" disabled selected>Status Type</option>

            <?php foreach($statustype as $rows) { ?>
            <option value="<?php echo $rows->status_type_id?>"><?php echo ucfirst($rows->status)?></option>
            <?php } ?>

        </select>
    </div><br>

    <div class="form-group">
        <label><b>Select Interview Type:</b></label>
        <select class="form-control" name="selection_id">
            <option value="" disabled selected>Interview Type</option>

            <?php foreach($interviewtype as $rows) { ?>
            <option value="<?php echo $rows->interview_type_id?>"><?php echo ucfirst($rows->interview_type_name)?></option>
            <?php } ?>

        </select>
    </div><br>

    <div class="form-group">
        <label><b>Selection Process:</b></label>
        <select class="form-control" name="selection_process_id">
            <option value="" disabled selected>Selection Process Type</option>

            <?php foreach($selectionprocess as $rows) { ?>
            <option value="<?php echo $rows->selection_process_id?>"><?php echo ucfirst($rows->selection_process)?></option>
            <?php } ?>

        </select>
    </div><br>

    <button type="button" name="submit" value="submit" class="btn btn-primary">Submit</button>

</form>

Controller Code:

function candidate_process($candidateid){  

    $data["msg"]="";
    $this->load->model('CandidateModel');
    $data['statustype']=$this->CandidateModel->getstatustypes();
    $data['interviewtype']=$this->CandidateModel->getinterviewtypes();
    $data['selectionprocess']=$this->CandidateModel->getselectionprocess();
    $data['candidate']=$this->CandidateModel->getcandidates();
    $data['usertype']=$this->CandidateModel->getvendors();
    $data['getCandidate'] = $this->CandidateModel->get_candidate_detail($candidateid);

    if($this->input->post()) { 
        $this->CandidateModel->add_candidate_selection($this->input->post());
    }

    $this->load->view('Candidates/candidate_process',$data);
}

Model:

public function add_candidate_selection($data){ 
    $data=array(
        'candidate_id'=>$this->input->post('candidate_id'),
        'user_id'=>$this->input->post('user_id'),
        'status_type_id'=>$this->input->post('status_type_id'),
        'interview_type_id'=>$this->input->post('interview_type_id'),
        'selection_process_id'=>$this->input->post('selection_process_id'),
        'date'=>$this->input->post('date')

        );
    $this->db->insert('candidate_selection', $data);
}

Can anyone help me? I did't get where I made a mistake.

1 Answer 1

1

The button type must be submit.

<button type="submit" name="submit" value="submit" class="btn btn-primary">Submit</button>
Sign up to request clarification or add additional context in comments.

2 Comments

ya type is in submit only?
Yes. You have to set the button type to submit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.