Note that there are some explanatory texts on larger screens.

plurals
  1. POCodeigniter links, modify them
    primarykey
    data
    text
    <p>I have a codeigniter controller with the following <code>check()</code> function to check username and password.</p> <pre><code>http://localhost/prakash/modules/index.php/login/login/login/login/login/login/check </code></pre> <p>and every time I submit the form (from the view), the above link is generated. How can I overcome it. I could have used <code>redirect('login')</code> in the controller instead of <code>$this-&gt;load-&gt;view('login/login_form');</code> but in that way it wouldnt display the validation errors in the form.</p> <p><strong>My Controller is</strong></p> <pre><code>function check(){ $this-&gt;form_validation-&gt;set_rules('username', 'Username', 'required'); if($this-&gt;form_validation-&gt;run()==FALSE){ $this-&gt;load-&gt;view('login/login_form'); }else{ $this-&gt;load-&gt;model('loginModel'); $query = $this-&gt;loginModel-&gt;validate(); if($query){ $data = array('username' =&gt; $this-&gt;input-&gt;post('username'), 'is_logged_in' =&gt; true ); $this-&gt;session-&gt;set_userdata($data); //redirecting to appropriate page redirect('success'); }else{ $this-&gt;session-&gt;set_flashdata('loginCheck','Username/Password Comination Incorrect!'); redirect('login'); } } } </code></pre> <p><strong>My view is</strong></p> <pre><code>&lt;section class="main"&gt; &lt;form class="form-1" action="login/check" method="post"&gt; &lt;?php echo "&lt;p class=\"text-error\"&gt;{$this-&gt;session-&gt;flashdata('loginCheck')}&lt;/p&gt;"; ?&gt; &lt;?php echo validation_errors(); ?&gt; &lt;p class="field"&gt; &lt;input type="text" name="username" placeholder="Username or email"&gt; &lt;i class="icon-user icon-large"&gt;&lt;/i&gt; &lt;/p&gt; &lt;p class="field"&gt; &lt;input type="password" name="password" placeholder="Password"&gt; &lt;i class="icon-lock icon-large"&gt;&lt;/i&gt; &lt;/p&gt; &lt;p class="submit"&gt; &lt;button type="submit" name="submit"&gt;&lt;i class="icon-arrow-right icon-large"&gt;&lt;/i&gt;&lt;/button&gt; &lt;/p&gt; &lt;/form&gt; &lt;/section&gt; </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.
 

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