Page 1 of 1

Space in user registration username

Posted: Mon Nov 28, 2011 12:41 pm
by shaunthomson
Hi

I've almost got the Register and Login tut working.

When registering, if I enter a username but no pass, when the page comes back, the username reappears in the form field, but it has a space entered before it.

Here's the code:
<input type="text" name="username" id="username" value=" <?php if(isset($_POST['username']))echo htmlentities($_POST['username']);?>" />
Has anyone else had the same thing?

Thanks

ps - I just noticed that if you repeat the above process, spaces just keep getting added
Shaun

Re: Space in user registration username

Posted: Mon Nov 28, 2011 1:21 pm
by Temor
you have a space here:
value=" <?php 
remove that space.

Re: Space in user registration username

Posted: Mon Nov 28, 2011 2:10 pm
by shaunthomson
Cheers Temor - I should have looked harder before posting - thanks for your time mate.

Re: Space in user registration username

Posted: Mon Nov 28, 2011 2:29 pm
by Temor
No worries. That's what I'm here for!

Re: Space in user registration username

Posted: Mon Nov 28, 2011 7:07 pm
by jacek
shaunthomson wrote:Cheers Temor - I should have looked harder before posting - thanks for your time mate.
I have been in situations like this too, you convince yourself that the problem is with a certain thing and then forget about the rest of the code. Don't worry about it :)