1
In a simple application. A value is passed to view. However codeigniter reports an error:
PHP code:
class User extends CI_Controller {
public function __construct(){
parent::__construct();
$this->load->helper('url');
$this->load->model('user_model');
$this->load->library('session');
}
public function index()
{
}
public function alterarUsuario(){
$teste ="2";
$this->load->view('teste.php', $teste);
}
}
?>
View code:
<?php
$teste = $_REQUEST['teste'];
echo "Resposta: ".$id;
?>
Error message:
in addition, the documentation in English may help, https://cibr.github.io/User-Guide-CodeIgniter-PtBr/general/views.html#Adding-Dynamic-data-to-the-view
– Marcelo Diniz