title: codeigniter form_validation is not working...(for me)
body: <p>Ok, I'm trying to validate a form in codeigniter</p>
  
  <p>as a first step I want to make all fields in my form required to make an entry...
  but I can't make it work </p>
  
  <p>here is the code:<p>
  myBlog.php</p>
  
  <pre><code>    &lt;?php
  
      class MyBlog extends Controller{
  
  
         function MyBlog(){
             parent::Controller();
             $this-&gt;load-&gt;helper('url'); //here we load a url class that we use later
             $this-&gt;load-&gt;helper('form');// here we load form class
  
  
             $this-&gt;load-&gt;scaffolding('entries');  //scaffolfing is a feature that lets you add or remove elements from the database
  
  
  
              $this-&gt;load-&gt;library('form_validation');//load validation class used to validate our forms...
         }
  
        function index(){
  
            $data['title'] = "My Blog Title"; //the title of my blog
            $data['query'] = $this-&gt;db-&gt;get('entries'); //here we make a small query to entries table
  
  
            $this-&gt;load-&gt;view('myBlog_view', $data); ///load all data variables on myBlog_view.php
           //this is also for the form validation
  
  
              $this-&gt;form_validation-&gt;set_rules('title', 'Title', 'required');
              $this-&gt;form_validation-&gt;set_rules('body', 'Body', 'required');
              $this-&gt;form_validation-&gt;set_rules('author', 'Author', 'required');
  
  
  
  
  
            if ($this-&gt;form_validation-&gt;run() == FALSE)
              {
                  //$this-&gt;load-&gt;view('myBlog_view');
              }
              else
              {
                  $this-&gt;load-&gt;view('formSuccess_view');
              }
  
   }
  
  
  
  
  
  
       function myBlog_insert(){
  
             $this-&gt;db-&gt;insert('entries', $_POST);
  
             redirect('myBlog/');
             }
  
  
      } 
  
      ?&gt;
  </code></pre>
  
  <p>also myBlog_view.php file:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  
  &lt;title&gt;&lt;?php echo $title; ?&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  
  
  
  &lt;?php foreach($query-&gt;result() as $row): ?&gt;
   &lt;div class='curvebox'&gt;
  &lt;h3&gt;&lt;?=$row-&gt;title?&gt;&lt;/h3&gt;
  
  
  &lt;p class="bodyText"&gt;&lt;?=$row-&gt;body?&gt;&lt;/p&gt;
  &lt;div class="author"&gt;&lt;?="by: ".$row-&gt;author." on ".date("D d M Y h:i:s A", strtotime($row-&gt;date_time))?&gt;&lt;/div&gt;
  &lt;p class="comments"&gt;&lt;?=anchor('myBlog/comments/'.$row-&gt;id, 'Comments');?&gt;&lt;/p&gt;
  &lt;/div&gt;
  
  
  &lt;?php endforeach; ?&gt;
  
  
  
  &lt;div class="theForm"&gt;
  
  &lt;?php echo $this-&gt;form_validation-&gt;error_string; ?&gt;
  
  &lt;?=form_open('myBlog/myBlog_insert');?&gt;
  
  
  &lt;label for="title"&gt;Title:&lt;/label&gt;
  
  &lt;input type='text' name="title" size="40" id="title" /&gt;
  &lt;p&gt;
  &lt;label for="body"&gt;Body:&lt;/label&gt;
  &lt;textarea name="body" rows = "10" cols="60" id="body"&gt;&lt;/textarea&gt;
  &lt;/p&gt;
  &lt;p&gt;
  &lt;label for="author"&gt;Author:&lt;/label&gt;
  &lt;input type="text" name="author" size="40" id="author"/&gt;
  &lt;/p&gt;
  &lt;p&gt;&lt;input type="submit" value="Submit New Post"/&gt;&lt;/p&gt;
  &lt;/form&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>everything works fine except the fact that it would accept entries with by a form half-filled <p>
  sorry for the long code....
  any help would be appreciated </p>