Welcome Guest, Not a member yet? Register   Sign In
Undefined variable: form_open
#1

[eluser]OregonGold[/eluser]
Following the blog tutorial, everything was going smooth until I got to the comment form. I followed the code step by step and im receiving this error page.

A PHP Error was encountered

Severity: Notice

Message: Undefined variable: form_open

Filename: views/comment_view.php

Line Number: 11

Fatal error: Function name must be a string in C:\wamp\www\ci\system\application\views\comment_view.php on line 11


here is the comment_view.php

Code:
<?=$form_open('blog/comment_insert');?>

<?=$form_hidden('entry_id', $this->uri->segment(3));?>
<p>&lt;textarea name="body" rows="10"&gt;&lt;/textarea></p>
<p>&lt;input type="text" name="author" /&gt;&lt;/p>
<p>&lt;input type="submit" value="Submit Comment" /&gt;&lt;/p>
&lt;/form&gt;


and blog.php controller

Code:
&lt;?php

class Blog extends Controller {
    
    function Blog()
    {
      parent::Controller();
      
      //$this->load->scaffolding('entries');
      $this->load->helper('url');
      $this->load->helper('form');
    }
    
    function index()
    {
       $data['title'] = "My blog title";
       $data['heading'] = "My blog heading";
       $data['query'] = $this->db->get('entries');
      
       $this->load->view('blog_view', $data);
    }
    
    function comments()
    {
       $data['title'] = "My comment title";
       $data['heading'] = "My comment heading";
      
       $this->load->view('comment_view', $data);
    }
}

?&gt;

I even tried adding it to the autoload.php and still nothing.

Code:
$autoload['helper'] = array('url', 'form');

I dont see any problems, do you?
#2

[eluser]Dam1an[/eluser]
Get rid of the $ infront of form_open
It thinks it's a variable, but it should be a function
#3

[eluser]OregonGold[/eluser]
Oh, wow I feel like a idiot now, haha. maybe it was the 3am 1 eye open syndrome. thank you.




Theme © iAndrew 2016 - Forum software by © MyBB