0
Good evening, I have a problem submitting a form, I am using codeIgniter 3 and I have the following screen:
<!-- modal -->
<div class="modal fade" id="modalArea" tabindex="-1" aria-labelledby="modalAreaLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title"><i class="fa fa-barcode"></i> Cadastrar área</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<!-- Inicio do formulario -->
<form action="<?= base_url('area/insertArea')?>" method="POST" class="form" role="form">
<div class="row">
<input type="hidden" class="form-control" id="id" name="id" value="">
<div class="col-sm-6">
<div class="form-group">
<label for="description" class="control-label"> Descrição área <span> <strong>*</strong></span></label>
<input type="text" class="form-control" id="description" name="description" placeholder="Ex: Bancos" required>
</div>
</div>
<div class="form-group col-md-12">
<button type="submit" class="btn btn-info"> <i class="fa fa-save"></i> Gravar</button>
<button type="button" class="btn btn-primary" data-dismiss="modal">Fechar</button>
</div>
</div>
</form>
<!-- final formulario -->
</div>
</div>
</div>
</div>
<!-- final modal -->
As you can see Record is inside the form, but when I click does not perform an action, my controller is like this:
class Area extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('Area_Model');
$this->data['title'] = 'Archive';
$this->data['complement'] = 'Área';
}
public function index()
{
$this->load->view('area/index', $this->data);
}
public function insertArea()
{
$this->form_validation->set_rules('description', 'Area', 'required', array('required' => 'o campo %s é obrigatorio'));
if ($this->form_validation->run() === false) {
$this->load->view('area/');
} else {
$this->load->model('Area_Model', 'area');
if ($this->area->insertArea($this->session->userdata['session_archive']['company_id'], $this->input->post("description", true))) {
echo 'ok';
} else {
echo 'nao salvou';
}
}
}
}
Obs: If I type in the URL directly it arrives normally in the controller and does everything right, the problem is the non-transfer button, it’s like I’m out of the form but as you can see it’s in the form.
All right, but where’s that piece of code in the question? For your answer and question to have any meaning it would be necessary that this passage be included in the question.
– user60252