 <p>You should read some basic CI first:</p> <pre><code>function index() { $this-&gt;load-&gt;model('setting/model_setting'); //load model if( $this-&gt;input-&gt;post(null) ){ //detect if form is submitted if(null !==($this-&gt;input-&gt;post('config_template'))) { $data['config_template'] = $this-&gt;input-&gt;post('config_template'); } else { $data['config_template'] = $this-&gt;theme-&gt;get('value'); // Auto loaded Library Theme } if($this-&gt;form_validation-&gt;run()) { $this-&gt;model_setting-&gt;updateTheme(); } redirect('setting/store'); }else{ // load view only $data['templates'] = array(); $directories = glob(DIR_CATALOG . 'views/theme/*', GLOB_ONLYDIR); foreach ($directories as $directory) { $data['templates'][] = basename($directory); } $this-&gt;form_validation-&gt;set_rules('config_template', '', 'callback_validate'); $this-&gt;lang-&gt;load('setting/setting', 'english'); $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array( 'text' =&gt; $this-&gt;lang-&gt;line('text_home'), 'href' =&gt; site_url('common/dashboard') ); $data['breadcrumbs'][] = array( 'text' =&gt; $this-&gt;lang-&gt;line('heading_title'), 'href' =&gt; site_url('setting/setting') ); $data['action'] = site_url('setting/setting'); $data['title'] = "Settings"; $data['entry_template'] = $this-&gt;lang-&gt;line('entry_template'); $data['header'] = $this-&gt;header($data); $data['footer'] = $this-&gt;footer($data); $this-&gt;load-&gt;view('setting/setting', $data); } } </code></pre> <p>You should first check if there is any post request, if there is update and redirect else show the form.</p>