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

[eluser]Unknown[/eluser]
EDIT: Nevermind this post! I already saw the mistake. That's what I get for coding without coffee. Sorry everyone!

Hi, I'm having some trouble with receiving POST data.

I have a login form with the fields 'username' and 'password'. After I send the form, the same controller reads the POST data using $this->input->post() and logs the values of the username and password fields using log_message():

Code:
$username = $this->input->post('username');
$password = $this->input->post('password');
log_message('debug', 'username = '.$username.'; password = '.$password.';');

My problem is that the username field is taking the password field's value, and the password field is coming out blank. For example, if I input the username "user1" and the password "pass1", I get:

Code:
DEBUG - 2009-09-18 23:42:29 --> username = user1; password = ;

Any help would be appreciated.

P.S.: Here follows my login form. Sorry for the spanish.

Code:
<form action="<?=$url_base?>login/" method="POST" id="login" name="login">

                <table>
                    <tr>
                        <th>&nbsp;</th>
                        <td>
                            <select name="logintype" id="logintype">
                                <option value="normal">ingreso normal</option>
                                <option value="openid" class="con-icono openid">OpenID</option>
                                <option value="google" class="con-icono google">Google</option>
                                <option value="bookface" class="con-icono bookface">Facebook</option>
                                <option value="lj" class="con-icono lj">Livejournal</option>
                                <option value="linkedin" class="con-icono linkedin">LinkedIn</option>
                                <option value="twitter" class="con-icono twitter">Twitter</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <th><span id="nombre-label">Nombre / E-mail</span></th>
                        <td>&lt;input type="text" class="t" size="20" id="username" name="username" value="" /&gt;&lt;/td>
                    </tr>
                    <tr>
                        <th>Contrase&ntilde;a</th>
                        <td>&lt;input type="password" class="t" size="20" id="password" name="username" value="" /&gt;&lt;/td>
                    </tr>
                    <tr>
                        <th>&nbsp;</th>
                        <td>&lt;input type="submit" class="b" value="Ingresar" /&gt;&lt;/td>
                    </tr>
                </table>
                
            &lt;/form&gt;
#2

[eluser]Julian Mesa[/eluser]
Hello!

Amigo tu error esta en el formulario en la vista.

Tu tienes esto:
Code:
&lt;input type="password" class="t" size="20" id="password" name="username" value="" /&gt;

Y deberia ser asi:
Code:
&lt;input type="password" class="t" size="20" id="password" name="password" value="" /&gt;

Saludos.




Theme © iAndrew 2016 - Forum software by © MyBB