title: registers with the verification email , but when submitted insert double data
body: <p>still continue the project which I've posted . a bit of trouble on registering with a verification email . currently running normally: registers the verification email, sents to the email destination. but I see there are two inserts with the same data (as submitted) in the database. Is there anything wrong with my script ?</p>
  
  <p>this my controllers </p>
  
  <pre><code>function submit() {
  
      $_POST['dob'] = $_POST['year'].'-'.$_POST['month'].'-'.$_POST['day'];
  
      $firstname = $this-&gt;input-&gt;post('firstname');
      $lastname = $this-&gt;input-&gt;post('lastname');     
      $password = $this-&gt;input-&gt;post('password');
      $email = $this-&gt;input-&gt;post('email');
      $dob = $this-&gt;input-&gt;post('dob');
      $jkl = $this-&gt;input-&gt;post('jkl');   
      $lastlogin = $this-&gt;input-&gt;post('lastlogin');       
  
      $data = array(
          'firstname' =&gt; $firstname,
          'lastname' =&gt; $lastname,
          'password' =&gt; $password,
          'email' =&gt; $email,  
          'dob' =&gt; $dob,
          'jkl' =&gt; $jkl,
          'lastlogin' =&gt; $lastlogin,
          'active' =&gt; 0
      );
  
      $this-&gt;m_register-&gt;add_account($data);  
      $id = $this-&gt;m_register-&gt;add_account($data);
  
      $encrypted_id = md5($id);
  
      $this-&gt;load-&gt;library('email');
  
      $config = Array(
      'protocol' =&gt; 'smtp',
              'smtp_host' =&gt; 'ssl://smtp.gmail.com',
              'smtp_port' =&gt; 465,
              'smtp_user' =&gt; '*******@*****.com ',
              'smtp_pass' =&gt; '**********',
              'mailtype'  =&gt; 'html', 
              'charset' =&gt; 'utf-8',
              'wordwrap' =&gt; TRUE
          );      
  
             $this-&gt;load-&gt;library('email', $config);
             $this-&gt;email-&gt;set_newline("\r\n");
             $email_setting  = array('mailtype'=&gt;'html');
             $this-&gt;email-&gt;initialize($email_setting);
             $this-&gt;email-&gt;from('*****@******.COM', 'RRR');
             $this-&gt;email-&gt;to($email);
             $this-&gt;email-&gt;subject('Confirmation Email');
             $this-&gt;email-&gt;message("WELCOME TO RRRR &lt;br&gt;&lt;p&gt;&lt;/p&gt;Hallo $firstname $lastname &lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;Terimakasih telah melakuan registrasi dengan:&lt;br&gt;&lt;br&gt;&lt;p&gt;
                         Username   = $email&lt;p&gt;
                         Password   = $password
                         &lt;br&gt;&lt;br&gt;
                         &lt;p&gt;
                         untuk memverifikasi akun silahkan klik tautan dibawah ini&lt;/p&gt;&lt;br&gt;&lt;br&gt;"
                         .site_url("login/register/verification/$encrypted_id")."
                         &lt;br&gt;&lt;br&gt;&lt;br&gt;
                         &lt;p&gt;&lt;/p&gt;&lt;br&gt;
  
                         &lt;p&gt;Thanks&lt;/p&gt;Admin ");
  
  
      if($this-&gt;email-&gt;send())
      {
      $data = array ( 'isi' =&gt; 'login/vsuccess');
              $this-&gt;load-&gt;view('layout/wrapper',$data);
      }else
      {
      $data = array ( 'isi' =&gt; 'login/vgagal');
              $this-&gt;load-&gt;view('layout/wrapper',$data);
      }
  
  
  }   
  </code></pre>
  
  <p>this my models</p>
  
  <pre><code>    function add_account($data){
          $this-&gt;load-&gt;database();
          $this-&gt;db-&gt;insert('user',$data);
          return  mysql_insert_id();
      }
  </code></pre>