CodeIgniter Forums
input->post doesn't work - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: input->post doesn't work (/showthread.php?tid=2701)



input->post doesn't work - El Forum - 08-20-2007

[eluser]snaggy[/eluser]
input->post always returns false.. what am I doing wrong?

The code that follows is being executed on a freshly installed CI, last version

Code:
<?php

class Welcome extends Controller {

    function Welcome()
    {
        parent::Controller();    
    }
    
    function index()
    {
        $this->load->view('welcome_message');
    }
    
    function post(){
        echo "mex:".$this->input->post('example');
    }
}
?>


Code:
<html>
<head>
<title>Welcome to CodeIgniter</title>

</head>
<body>

<h1>Welcome to CodeIgniter!</h1>

<p>The page you are looking at is being generated dynamically by CodeIgniter.</p>

<p>If you would like to edit this page you'll find it located at:</p>
<code>system/application/views/welcome_message.php</code>

<p>The corresponding controller for this page is found at:</p>
<code>system/application/controllers/welcome.php</code>

<p>If you are exploring CodeIgniter for the very first time, you should start by reading the <a href="user_guide/">User Guide</a>.</p>


<p><br />Page rendered in {elapsed_time} seconds</p>

&lt;form id="form" action="http://localhost/post/index.php/welcome/post" method="POST"&gt;
&lt;input type="text" id="example" value="message" /&gt;
&lt;input type="submit" name="submit" /&gt;
&lt;/form&gt;

&lt;/body&gt;
&lt;/html&gt;

what's wrong in my code?

bye!


input->post doesn't work - El Forum - 08-20-2007

[eluser]Derek Jones[/eluser]
You're missing a name= attribute in your input tag. It's a required attribute (for button, checkbox, file, hidden, image, password, text, and radio) to provide a unique identifier for the form field. id is for the DOM, name is for the form data.


input->post doesn't work - El Forum - 08-20-2007

[eluser]snaggy[/eluser]
Well I can't believe I waste a hour on this stupid problem!!
Thank you!