Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Their is not possible to include javascript code into controller.</p> <p>Possible Solutions</p> <p>Method one: </p> <p>Create one error view and when ever you want to show some error redirect user to that page.</p> <p>Method two:</p> <pre><code>public function login_form() { $CI = &amp; get_instance(); /// Added New line $this-&gt;form_validation-&gt;set_rules('username', 'Username', 'required|trim|xss_clean'); $this-&gt;form_validation-&gt;set_rules('password', 'Password', 'required|md5|xss_clean'); $this-&gt;form_validation-&gt;set_error_delimiters('&lt;span class="error"&gt;', '&lt;/span&gt;'); if($this-&gt;form_validation-&gt;run()==FALSE) { $this-&gt;load-&gt;view('v_admin_login'); } else { $username = $this-&gt;input-&gt;post('username'); $password = $this-&gt;input-&gt;post('password'); $cek = $this-&gt;m_admin_login-&gt;getAdmin($username, $password, 1, 1); if($cek &lt;&gt; 0) { $this-&gt;session-&gt;set_userdata('isLogin', TRUE); $this-&gt;session-&gt;set_userdata('username',$username); $this-&gt;session-&gt;set_userdata('level',$level); redirect('admin'); } else { /// Added New Section $this-&gt;theme-&gt;set_message('Your error Msg', 'error'); $data = array("username" =&gt; $this-&gt;input-&gt;post('username');, "password" =&gt; $this-&gt;input-&gt;post('password');, "ci" =&gt; $CI ); } } $this-&gt;theme-&gt;view($data, "Your view page"); /// Added New line } </code></pre> <p><strong>Now in View</strong> </p> <p>Put this line where you want to show msg</p> <pre><code>&lt;?php echo $ci-&gt;theme-&gt;message(); ?&gt; /// Added New line </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload