 <p><strong>Change</strong> this to (<strong><em>Best Practices</em></strong>) </p> <pre><code>if ($this-&gt;form_validation-&gt;run() == TRUE) </code></pre> <p>this</p> <pre><code>if ($this-&gt;form_validation-&gt;run() == FALSE) </code></pre> <blockquote> <p><strong>Since you haven’t told the Form Validation class to validate anything yet, it returns FALSE (boolean false) by default. <code>The run()</code> method only returns TRUE if it has successfully applied your rules without any of them failing.</strong></p> </blockquote> <p><a href="https://www.codeigniter.com/userguide3/libraries/form_validation.html#try-it" rel="nofollow">Check Why</a></p> <hr> <p><strong>Add this in controller</strong></p> <pre><code>$this-&gt;form_validation-&gt;set_error_delimiters('&lt;div class="alert alert-danger alert-dismissible" role="alert"&gt; &lt;button type="button" class="close" data-dismiss="alert" aria-label="Close"&gt;&lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;&lt;/button&gt;', '&lt;/div&gt;'); </code></pre> <p>and <strong>remove this</strong> </p> <pre><code>echo validation_errors('&lt;div class="alert alert-danger alert-dismissible" role="alert"&gt; &lt;button type="button" class="close" data-dismiss="alert" aria-label="Close"&gt;&lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;&lt;/button&gt;', '&lt;/div&gt;'); </code></pre> <p><a href="https://www.codeigniter.com/userguide3/libraries/form_validation.html#changing-the-error-delimiters" rel="nofollow">Check Why</a></p> <hr> <p><strong>Add this in form below the respective input fields</strong> </p> <pre><code>echo form_error('usuario'); echo form_error('senha'); </code></pre> <p>Or add </p> <pre><code>&lt;?php echo validation_errors(); ?&gt; </code></pre> <p><a href="https://www.codeigniter.com/userguide3/libraries/form_validation.html#showing-errors-individually" rel="nofollow">Check Why</a></p> <hr> <p><a href="https://www.formget.com/form-validation-using-codeigniter/" rel="nofollow">CodeIgniter Form Validation Example</a></p>