CodeIgniter Forums
[solved] CI 1.7.3 no data in $_POST array - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: [solved] CI 1.7.3 no data in $_POST array (/thread-38524.html)



[solved] CI 1.7.3 no data in $_POST array - El Forum - 02-10-2011

[eluser]SPeed_FANat1c[/eluser]
Don't undestand, such simple thing but does not work.

Code:
<form action = "<?php echo base_url()?>admin_/groups/preview" target = "">
                <strong>Pavadinimas: </strong><br>
                &lt;input type="text" name="title" /&gt;&lt;br><br>
                <strong>Tekstas: </strong><br>
                &lt;textarea name = "text" cols = "90" rows = "90"&gt;&lt;/textarea><br>
                &lt;input class = "save" type="button" name="submit" value = "Išsaugoti"/&gt;
                &lt;input class = "preview" type="submit" name="preview" value = "Peržiūrėti" /&gt;
            &lt;/form&gt;

I press button withd class = "preview", it calls the right funciton, which is in action attribute, but there is no data in post array.

This does not echo anything. Can you help me?
Code:
function preview()
    {
        
        echo $this->input->post('title');
        //echo stripslashes($_POST['text']);
    }



[solved] CI 1.7.3 no data in $_POST array - El Forum - 02-10-2011

[eluser]toopay[/eluser]
add ';'
Code:
&lt;?php echo base_url();?&gt;



[solved] CI 1.7.3 no data in $_POST array - El Forum - 02-11-2011

[eluser]SPeed_FANat1c[/eluser]
The ; is not needed. It generates fine url even when I don't use it. I found that the problem was that it used the $_GET array. I didn't add attribute method = "post". I knew there was something stuppid. I usually use echo form_open() function to create a form tag and probably it automatically adds method = "post" attribute, so thats why I forget it there Smile