3
I’m using Codeigniter in a project but I’m having a hard time sending the information, I have a view that contains a form with the registration fields:
<?php
echo form_open_multipart('Controller_site/cadastro_form');
?>
<input type="text" class="input-text" name="pais" placeholder="País">
</div>
</div>
</div>
Within this view I have several other fields that are being "wrapped" with Divs (Bootstrap) to assemble the layout. I’m closing the form on the last div:
<div class="row">
<div class="col-md-12" align="center">
<button type="button" class="btn btn-success">Cadastrar</button>
<?php
echo form_close();
?>
</div>
In Controller_site I have the following function:
public function cadastro_form(){
$data = 'null';
$data = array(
'pais' => $this->input->post('pais'),
'name_users' => $this->input->post('name_users'),
'last_name' => $this->input->post('last_name'),
'date_nasc' => $this->input->post('date_nasc'),
'sexo' => $this->input->post('sexo'),
'cpf' => $this->input->post('cpf'),
'mail' => $this->input->post('mail'),
'phone' => $this->input->post('phone'),
'cep' => $this->input->post('cep'),
'logradouro' => $this->input->post('logradouro'),
'bairro' => $this->input->post('bairro'),
'num' => $this->input->post('num'),
'city' => $this->input->post('city'),
'state' => $this->input->post('state'),
'payment' => $this->input->post('payment'),
'num_cart' => $this->input->post('num_cart'),
'validade' => $this->input->post('validade'),
'agencia' => $this->input->post('agencia'),
'conta' => $this->input->post('conta'),
'cvv' => $this->input->post('cvv'),
'login' => $this->input->post('login'),
'senha' => $this->input->post('senha'),
'confirmar_senha' => $this->input->post('confirmar_senha'),
);
$this->Model_site->cadastro($data);
redirect("index", 'redirect');
}
}
In the model: public Function registration ($date){
return $this->db->insert('tb_users',$data);
}
}
I fill the form data and nothing happens the page is the same way the button "looks" nor have button effect.
Note: The database file is already configured.
Button with
type="button"
does not submit form. Puttype="submit"
– Woss
It worked! Thank you very much (; Could you help me with something else, the url is duplicating you know how to resolve: http://localhost/superbat/index.php/Controller_site/localhost/Superbat/Controller_site/cadastro_form
– Eduarda Rosa