Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- defined('BASEPATH') OR exit('No direct script access allowed');
- /**
- * @author ralf
- * @desc Clase IMC que contiene los calculos aritmeticos
- * **/
- class Imc extends CI_Controller{
- public function __construct(){
- parent::__construct();
- $this->load->model('imc_model');
- $this->load->helper(array('url','language'));
- }
- public function index(){
- //https://pastebin.com/xfhPyQ63
- $this->load->helper(array('form', 'url'));
- $this->load->library('form_validation');
- //
- $this->form_validation->set_error_delimiters('<div class="alert alert-danger">', '</div>');
- $this->form_validation->set_rules('peso', 'Peso', 'required|trim|max_length[3]|integer');
- $this->form_validation->set_rules('estatura', 'Estatura', 'required|trim|max_length[3]|integer');
- //
- if ($this->form_validation->run() == FALSE){
- $this->load->view("imc_view");
- }else{
- //TRUE del formulario
- $datos['calculo'] = $this->input->post('peso') / ($this->input->post('estatura') * $this->input->post('estatura'));
- $this->imc_model->insertar($datos);
- $this->load->view("imc_view", $datos);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement