Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Password input element problem

Tags:

html

php

I have a password element which I use for signing in process. But, I get this weird username and password once the page gets opened !!

enter image description here

but the problem is when I don't user password element but only input I don't get this weird username and password, what should I do to make them blank?

Here's the code

    echo"
    <center><small>
    <br />
    &nbsp; &nbsp;
    <p> Welcome Guest you can sign in here:</p></br>
    <form action = \"HomeWork.php\" method = \"post\">
    User name*: <input type=\"text\" name=\"Username\" />
    Password*: <input type=\"password\" name=\"Password\" />&nbsp;

<a href=\"Signup.php\">or Sign up !</a>
        <br /> <br />
        <input type=submit value=Submit align=\"middle\" />
        </form>
        </small></center>";

Can you help me??

like image 577
Lisa Avatar asked Nov 30 '25 01:11

Lisa


2 Answers

This is your browser remembering the username/password you've entered in for your localhost site. This isn't to do with your html or php. To test, try it out in another browser that you have used to view the localhost site and see if it adds it to the form elements.

EDIT

Note, following kag's answer, you can add autocomplete=off to the form to prevent the browser from autocompleting.

https://developer.mozilla.org/en/how_to_turn_off_form_autocompletion

echo "
<center>
 <small>
  <br />
  &nbsp;
  <p>Welcome Guest you can sign in here:</p></br>
  <form action='HomeWork.php' method='post' autocomplete='off'>
   Username*: <input type='text' name='Username' />
   Password*: <input type='password' name='Password' />&nbsp;
   <a href='Signup.php'>or Sign up !</a>
   <br />
   <input type='submit' value='Submit' align='middle' />
  </form>
 </small>
</center>
";

Also, consider not using tags like center and small; instead use css and classes/selectors.

like image 126
Jared Farrish Avatar answered Dec 02 '25 15:12

Jared Farrish


This is your browser trying to help you by automatically filling the fields for you. If you want to stop it from doing so, you can add autocomplete="off" in both <input>.

like image 45
kag Avatar answered Dec 02 '25 13:12

kag



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!