insert codeigniter

0

Hi, I want to insert it in my db but for some reason I can not see the error.

<!DOCTYPE html>
<html>
<head>

    <title>x</title>
</head>
<body>
    <form action="<?= base_url('PeliculasController/create') ?>" method="post">
        <input type="text" name="idpelicula">
        <input type="text" name="nombre">
        <input type="text" name="apellido">
        <input type="text" name="cedula">
        <button type="submit">create</button>


    </form>

</body>
</html>

--- that view data should fall here on my controller -

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class PeliculasController extends CI_Controller {

    public function __construct()
    {
        parent::__construct();
        $this->load->model('PeliculasModel');
    }

    public function index()
    {
        $this->load->view('x/inicio');
    }

     function create(){
        echo "string";
        if ($_POST) {
            $this->PeliculasModel->crear($_POST);
        }
        $this->load->view('x/inicio');
    }

}

----------- here I call my model and I pass as parameter or argument the $ _POST -

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class PeliculasModel extends CI_Model {

    public $variable;

    public function __construct()
    {
        parent::__construct();

    }

     function crear($post){
        json_encode($post);
        $datosPelicula = array();
        $datosPelicula['nombre'] = $post['nombre'];
        $datosPelicula['apellido'] = $post['apellido'];
        $datosPelicula['cedula'] = $post['cedula'];
        $this->db->insert('nombres', $datosPelicula);


    }

}

to finish here I try to make the insert but it seems that the data never reach the controller

    
asked by Rangel 21.09.2018 в 22:08
source

0 answers