Note that there are some explanatory texts on larger screens.

plurals
  1. POCodeigniter handles Post as Get
    primarykey
    data
    text
    <p>I'm trying to build a simple login form as shown in this <a href="http://www.youtube.com/watch?v=Nqj39tri3KU" rel="nofollow">youtube video</a>. In the video it is shown that my login form should POST the information and not GET it, as you can see in the url the maker is redirecting to.</p> <p>However my CodeIgniter always GETs the information, after submitting my login information and being redirected to the following example link:</p> <pre><code>http://localhost/CodeIgniter/?email=member%40backupbull.com&amp;password=password13&amp;login_submit=Login </code></pre> <p>The form helper is autoloaded into CodeIgniter.</p> <p><strong>Controller:</strong></p> <pre><code>public function login() { $this-&gt;load-&gt;view('login'); } public function login_validation() { $this-&gt;load-&gt;library('form_validation'); $this-&gt;form_validation-&gt;set_rules('email','Email','required'); $this-&gt;form_validation-&gt;set_rules('password','Password','required|md5'); if($this-&gt;form_validation-&gt;run()){ redirect('pages/members'); } else { $this-&gt;load-&gt;view('login'); } } public function members(){ $this-&gt;load-&gt;view('members'); } </code></pre> <p><strong>View (login.php):</strong></p> <pre><code>&lt;?php $this-&gt;load-&gt;view('site_template/header.php'); ?&gt; &lt;body&gt; &lt;!--[if lt IE 7]&gt; &lt;p class="chromeframe"&gt;You are using an &lt;strong&gt;outdated&lt;/strong&gt; browser. Please &lt;a href="http://browsehappy.com/"&gt;upgrade your browser&lt;/a&gt; or &lt;a href="http://www.google.com/chromeframe/?redirect=true"&gt;activate Google Chrome Frame&lt;/a&gt; to improve your experience.&lt;/p&gt; &lt;![endif]--&gt; &lt;!-- This code is taken from http://twitter.github.com/bootstrap/examples/hero.html --&gt; &lt;?php $this-&gt;load-&gt;view('site_template/navigation.php'); ?&gt; &lt;div class="container"&gt; &lt;!-- Main hero unit for a primary marketing message or call to action --&gt; &lt;div class="hero-unit"&gt; &lt;h1&gt;Hello, world!&lt;/h1&gt; &lt;p&gt;This is a template for a simple marketing or informational website. It includes a large callout called the hero unit and three supporting pieces of content. Use it as a starting point to create something more unique.&lt;/p&gt; &lt;p&gt;&lt;a class="btn btn-primary btn-large"&gt;Learn more &amp;raquo;&lt;/a&gt;&lt;/p&gt; &lt;/div&gt; &lt;!-- Example row of columns --&gt; &lt;div class="row"&gt; &lt;div class="span4"&gt; &lt;h2&gt;Heading&lt;/h2&gt; &lt;p&gt;Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. &lt;/p&gt; &lt;p&gt;&lt;a class="btn" href="#"&gt;View details &amp;raquo;&lt;/a&gt;&lt;/p&gt; &lt;/div&gt; &lt;div class="span4"&gt; &lt;h2&gt;Heading&lt;/h2&gt; &lt;p&gt;Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. &lt;/p&gt; &lt;p&gt;&lt;a class="btn" href="#"&gt;View details &amp;raquo;&lt;/a&gt;&lt;/p&gt; &lt;/div&gt; &lt;div class="span4"&gt; &lt;h2&gt;Heading&lt;/h2&gt; &lt;p&gt;Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.&lt;/p&gt; &lt;p&gt;&lt;a class="btn" href="#"&gt;View details &amp;raquo;&lt;/a&gt;&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;hr&gt; &lt;?php $this-&gt;load-&gt;view('site_template/footer.php'); ?&gt; </code></pre> <p><strong>View (navigation.php) that is loaded in the login.php view:</strong></p> <pre><code>&lt;div class="navbar navbar-inverse navbar-fixed-top"&gt; &lt;div class="navbar-inner"&gt; &lt;div class="container"&gt; &lt;a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"&gt; &lt;span class="icon-bar"&gt;&lt;/span&gt; &lt;span class="icon-bar"&gt;&lt;/span&gt; &lt;span class="icon-bar"&gt;&lt;/span&gt; &lt;/a&gt; &lt;a class="brand" href="#"&gt;&lt;?php echo SITE_NAME; ?&gt;&lt;/a&gt; &lt;div class="nav-collapse collapse"&gt; &lt;ul class="nav"&gt; &lt;li class="active"&gt;&lt;a href="#"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="&lt;?php echo base_url(); ?&gt;pages/features"&gt;Features&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="&lt;?php echo base_url(); ?&gt;pages/pricing"&gt;Pricing&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="&lt;?php echo base_url(); ?&gt;pages/about_us"&gt;About Us&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="&lt;?php echo base_url(); ?&gt;pages/contact"&gt;Contact&lt;/a&gt;&lt;/li&gt; &lt;!-- &lt;li class="dropdown"&gt; &lt;a href="#" class="dropdown-toggle" data-toggle="dropdown"&gt;Dropdown &lt;b class="caret"&gt;&lt;/b&gt;&lt;/a&gt; &lt;ul class="dropdown-menu"&gt; &lt;li&gt;&lt;a href="#"&gt;Action&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Another action&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Something else here&lt;/a&gt;&lt;/li&gt; &lt;li class="divider"&gt;&lt;/li&gt; &lt;li class="nav-header"&gt;Nav header&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Separated link&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;One more separated link&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; --&gt; &lt;/ul&gt; &lt;form class="navbar-form pull-right"&gt; &lt;?php echo form_open('pages/login_validation'); echo validation_errors(); echo'&lt;p&gt;'; echo form_input('email', 'member@backupbull.com'); echo'&lt;/p&gt;'; echo'&lt;p&gt;'; echo form_password('password', 'password'); echo'&lt;/p&gt;'; echo'&lt;p&gt;'; echo form_submit('login_submit', 'Login'); echo'&lt;/p&gt;'; echo form_close(); ?&gt; &lt;!--&lt;input class="span2" type="text" placeholder="Email"&gt; &lt;input class="span2" type="password" placeholder="Password"&gt; &lt;button type="submit" class="btn"&gt;Sign in&lt;/button&gt;--&gt; &lt;/form&gt; &lt;/div&gt;&lt;!--/.nav-collapse --&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p><strong>.htaccess in root:</strong></p> <pre><code>&lt;IfModule mod_rewrite.c&gt; RewriteEngine On RewriteBase /BackupBull/ #Removes access to the system folder by users. #Additionally this will allow you to create a System.php controller, #previously this would not have been possible. #'system' can be replaced if you have renamed your system folder. RewriteCond %{REQUEST_URI} ^system.* RewriteRule ^(.*)$ /index.php?/$1 [L] #When your application folder isn't in the system folder #This snippet prevents user access to the application folder #Rename 'application' to your applications folder name. RewriteCond %{REQUEST_URI} ^application.* RewriteRule ^(.*)$ /index.php?/$1 [L] #Checks to see if the user is attempting to access a valid file, #such as an image or css document, if this isn't true it sends the #request to index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L] &lt;/IfModule&gt; &lt;IfModule !mod_rewrite.c&gt; # If we don't have mod_rewrite installed, all 404's # can be sent to index.php, and everything works as normal. ErrorDocument 404 /index.php &lt;/IfModule&gt; </code></pre> <p>I have no idea how to fix this problem.</p> <p>Thanks in advance for any help!</p>
    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.
 

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