Reputation: 14048
Can anyone tell me why this form does not properly submit values to server?
<form method="post" action="http://www.***.com/index.php/session/authenticate" class="form login" id="login_form">
<div class="group wat-cf">
<div class="left">
<label class="label right">Login</label>
</div>
<div class="right">
<input type="text" class="text_field" id="username"/>
</div>
</div>
<div class="group wat-cf">
<div class="left">
<label class="label right">Password</label>
</div>
<div class="right">
<input type="password" class="text_field" id="password"/>
</div>
</div>
<div class="group navform wat-cf">
<div class="right">
<button class="button" type="submit">
<img src="images/icons/key.png" alt="Save" /> Login
</button>
</div>
</div>
</form>
On the server side I echo out the $_POST
superglobal which is empty, and I can see my request headers which are sent when the form is submitted:
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Content-Length:0
Content-Type:application/x-www-form-urlencoded
Cookie:ci_session=***session_id=***user_agent%22%3Bs%3A50%3A%22Mozilla%2F5.0+%28Macintosh%3B+Intel+Mac+OS+X+10_6_7%29+App%22%3Bs%3A13%3A%22last_activity%22%3Bi%3A1307578661%3B%7D31ee24db2875550081268dc7df883f76; ci_csrf_token=***
Host:www.***.com
Origin:http://**.com
Referer:http://***.com/index.php/session/login
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/*** Safari/534.30
Upvotes: 1
Views: 2340
Reputation: 7673
It's the name attribute of input elements that's submitted on the form. Use name='username', etc.
Upvotes: 1
Reputation: 17109
You input
tags have no name
attribute. I think you are using id
's instead of name
's
For instance
<input type="text" class="text_field" id="username"/>
should be
<input type="text" class="text_field" id="username" name="username" />
or simply
<input type="text" class="text_field" name="username"/>
if you are not using the id
's for anything else.
Upvotes: 1
Reputation: 1207
You forgot to give the name for the input type, like this
<input type="text" class="text_field" name="username" id="username"/>
<input type="password" class="text_field" name="password" id="password"/>
Upvotes: 11