 <p>You can prevent it by setting rule for semester_id as follows</p> <pre><code>$this-&gt;form_validation-&gt;set_rules('semester_id', 'input_name', 'trim|required|is_unique[TABLENAME.COLUMNNAME]'); </code></pre>