Welcome Guest, Not a member yet? Register   Sign In
Submit simple form don't work.
#3

[eluser]Marcone Ramos[/eluser]
Thank you very much Coccodrillo.
I sorry for the mess I did with the code, I should have fixed it before sending and keep it simple so you could see what's my real problem. I'm not a native english speaker so I'll try explain again what's going on.
In the code bellow, when I click ENTRAR, it should be redirected to
Code:
c_loginsyslogin/index/
and execute what's inside of
Code:
if($this->input->post('bntEnter'))
        {
            echo "It works!";
            exit;
        }
, but that's not what happens for some reason. it reloads the form page, instead of show the "it works".
I'm posting a simple code again, so it will make easier for you guys to understand what's going on:

C_loginsyslogin
Code:
<?php

class C_loginsyslogin extends CI_Controller{
    

    function index()
    {
        // LOAD LIBRARIES
        $this->load->library(array('encrypt', 'form_validation', 'session'));
        // LOAD HELPERS
        $this->load->helper(array('form'));
        
        if($this->input->post('bntEnter'))
        {
            echo "It works!";
            exit;
        }
        
        $loadTemp['varContent']='v_loginsyslogin';
        $this->load->view('v_admintemplate', $loadTemp);
        
    }

}

/* End of file main.php */
/* Location: ./application/controllers/main.php */

?>

v_loginsyslogin
Code:
<?php if($this->session->flashdata('message')) : ?>
    <p>&lt;?=$this->session->flashdata('message')?&gt;</p>
&lt;?php endif; ?&gt;

&lt;? $attributes=array('name' => 'formLogin','class' => 'formLogin', 'enctype' => 'application/x-www-form-urlencoded'); ?&gt;
&lt;?=form_open('c_loginsyslogin/index/', $attributes)?&gt;
        <p>Por favor, identifique-se:</p>

        <p>
            &lt;?=form_label('Login:', 'user_name')?&gt;
            &lt;?
            //echo form_error("txtusername");
            $formBuildingData= array(
                'type' => "text",
                'name' => "txtusername",
                'class' => "normalText",
                'size' => "25"
                );
            ?&gt;
            &lt;?=form_input($formBuildingData)?&gt;
        </p>

        <p>
            &lt;?=form_label('Senha:', 'user_pass')?&gt;
            &lt;?
            //echo form_error("txtpasswordd");
             $formBuildingData2= array(
                'type' => "password",
                'name'=> "txtpassword",
                'class' => "normalText",
                'size' => "25"
            );
            ?&gt;
            &lt;?=form_password($formBuildingData2)?&gt;
        </p>

        <p>
            &lt;?
            $formBuildingData3=array(
            'type' => "submit",
            'name' => "bntEnter",
            'class'=> "buttonNormal",
            'value'=> "Entrar"
            );
            ?&gt;
            &lt;?=form_submit($formBuildingData3)?&gt;
        </p>

&lt;?=form_close();?&gt;

and this is the main template

Code:
<!doctype html>
&lt;html&gt;
&lt;?
$this->load->helper('html');
echo link_tag('CSS/adminsys.css'); ?&gt;
    &lt;head&gt;
        &lt;title&gt;&lt;!-- navigation --&gt;&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
        <nav>  
        </nav>  
        <section id="maincontent">
            &lt;?
            $this->load->view($varContent);
            ?&gt;
            <article class="blogPost">
                &lt;header&gt;
                    
                &lt;/header&gt;
                    
            </article>
        </section>
        <footer>
            &lt;!-- footer --&gt;
        </footer>
    &lt;/body&gt;
&lt;/html&gt;


Messages In This Thread
Submit simple form don't work. - by El Forum - 05-09-2011, 12:24 AM
Submit simple form don't work. - by El Forum - 05-09-2011, 05:12 AM
Submit simple form don't work. - by El Forum - 05-09-2011, 12:09 PM
Submit simple form don't work. - by El Forum - 05-11-2011, 11:33 AM
Submit simple form don't work. - by El Forum - 05-11-2011, 01:15 PM
Submit simple form don't work. - by El Forum - 05-11-2011, 02:07 PM
Submit simple form don't work. - by El Forum - 05-13-2011, 09:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB