I have this function on my code, and give me this error:
syntax error, unexpected '->' (T_OBJECT_OPERATOR), expecting ')' on line 25
I cant find the error maybe you can see what I can't D:
public function InsertHero()
{
$this->load->view('Header');
$this->load->view('HeroForm');
$this->load->view('Footer');
$data = array(
'Name' -> $this -> input -> post('nick'), //this is the line 25
'Power' -> $this -> input -> post('superpower'),
'Phone' -> $this -> input -> post('phone'),
'Email' -> $this -> input -> post('mail'),
'Category' -> $this -> input -> post('category_id')
);
$this->model_heroes->insert($data);
redirect(base_url());
}
Simple error, you have used the operator for classes/objects (T_OBJECT_OPERATOR is ->) in your array declaration, when you should have used the T_DOUBLE_ARROW => operator.
Therefore your array should look like;
$data = array('Name' => $this->input->post('nick'));
For reference PHP operators