tags:

views:

31

answers:

2

Hi,

I'm working with the Head First PHP/MySql book, and have a weird problem with one of the login scripts.

I'm making a page with two input fields, a username and a password. The Code looks like this:

 <label for="username">Username:</label>
            <input type="text" id="username" name="username"
                   value="<?php if(!empty ($user_username)) echo $user_username; ?>" /><br />
            <label for="password">Password:</label>
            <input type="password" id="password" name="password" />

When the page loads, the fields are automatically filled out with username 'root' and a password. I've echoed out $user_username, and it is empty (and either way I don't set a value for the password, so where does thta come from?)

Is this some browser related issue? Usinf Firefox 3.5.7

+4  A: 

Yes, it's most probably your saved passwords of Firefox kicking in. Go Tools->Options->Security to find options of turning this feature off and on again.

Raveren
+1  A: 

As browser auto-complete functionality generally works off field names, if firefox has a stored value to fill a box called username/password with then that will be where your content comes from.

If you don't want to turn off the browser auto-complete functionality you should be able to circumvent this issue by changing the fields names. Then your browser would also be able to store the values you wish to auto-complete these fields with if you desire.

Mike