Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Wendell Pulsipher
10,183 Points$_POST problems
I feel like this is a dumb question, but:
I have this in my login.php: if(isset($_POST['username']))
and the following form in the main page
<form action="login.php" method="POST" enctype="text/plain" class="login">
<table>
<tr>
<td>
<label>USERNAME</label>
</td>
<td>
<input type="text" name="username">
</td>
<td>
<label>PASSWORD</label>
</td>
<td>
<input type="password" name="pass">
</td>
<td>
<input type="submit" value="LOGIN">
</td>
</tr>
</table>
</form>
why is it telling me that $_POST['username'] isn't set?
4 Answers

Wendell Pulsipher
10,183 Pointsthe url was like http://www.insertwebsitehere.com/pagename.php?getvariable and the get variable was conflicting with the $_POST array so that was my problem

James Gill
Courses Plus Student 34,935 PointsWendell,
The most fundamental reason is that you may not have submitted the username--in other words, so it becomes part of the $_POST array.

Wendell Pulsipher
10,183 PointsOh holy cow. I figured out the problem. I had a get variable set when I submitted the form. Good heavens the staff must be getting sick of me now posting stuff like this. Sorry

James Gill
Courses Plus Student 34,935 PointsAh, so--it was a submission problem.