Welcome Guest, Not a member yet? Register   Sign In
Problems with Form_Open
#1

[eluser]Diego CODU[/eluser]
I created a form just as it always did, using the CI.
However, when submitting the form, it returns no $ _POST
I rewrote the code using standard HTML, to see if it was a server error, but it worked normal.
Can anyone give me a hint of what might be going wrong?
#2

[eluser]nelson.wells[/eluser]
Look at the source code and make sure the form is targeted at the correct page i.e.

Code:
<form action="http://www.domain.com/page" method="post">

Also, use Firebug to watch what variables are being passed to the script with the 'net' tab. Another thing you can try is double checking to make sure you have a </form> after you form. In some browsers, this caused the form not to submit.

Without any code, though, telling you exactly what is going on is much more difficult.
#3

[eluser]Diego CODU[/eluser]
I checked all that.
I think it gets easier to understand with the code:

My controller called (login) is only this:
Code:
class Login extends Controller {

    function Login()
    {
        parent::Controller();        
    }
    
    function index()
    {        
        $this->load->view('painel/_login');
        print_r($_POST);
        }
}

My view "_login.php" (inside the directory "view/painel/"):
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html &gt;
&lt;head&gt;
  &lt;meta http-equiv="content-type" content="text/html; charset=utf-8" /&gt;
    
    &lt;title&gt;PortalCOT.com&lt;/title&gt;

&lt;/head&gt;
&lt;body&gt;

<h2>Login - Painel</h2>


&lt;?php echo form_open("login");?&gt;
    
    <fieldset>
    
        <legend>Dados de acesso</legend>
        
        <h5>Login:</h5>
        &lt;input type="text" name="login" /&gt;
        
        <h5>Senha:</h5>
        &lt;input type="password" name="senha" /&gt;
        
        &lt;input type="submit" value="Enviar" name="form_login" /&gt;
    
    </fieldset>
    

&lt;/form&gt;

&lt;/body&gt;
&lt;/html&gt;
#4

[eluser]Diego CODU[/eluser]
More one thing,
when I use the HTML code
Code:
&lt;form action="xxx" method="post"&gt;
it's work perfectly
#5

[eluser]cahva[/eluser]
Just see what &lt;?php echo form_open("login");?&gt; gives you in the output. So check the generated html.
#6

[eluser]Diego CODU[/eluser]
It's generate the same code!
#7

[eluser]mi6crazyheart[/eluser]
Use this controller in u'r program.....
Code:
class Login extends Controller {

    function Login()
    {
        parent::Controller();        
    }
    
    function index()
    {  
        $this->load->helper(array('form', 'url'));
        $this->load->view('painel/_login');
        print_r($_POST);
        }
}




Theme © iAndrew 2016 - Forum software by © MyBB