how to ensure php/html login form does not load values in the username and password fields

I have written this simple php code (see below). The problem is that when i try running this code, the form loads values into both the username and password input fields. I have tried setting autocomplete = “off” in both the form tag and the input tag as suggested here but it does not seem to work. My browser if firefox 38.0 for Ubuntu canonical 1.0. What is the problem here?


if (isset($_POST['submit']) && !empty($_POST['username']) && !empty($_POST['password'])){echo "yesu";
  $username = $_POST['username']; 
  $password = md5 ($_POST['password'] . 'ijdb');
  print "welcome $username";
/*header ('Location: .');

<form action = "" method = "post" autocomplete = "off">
Username: <input type = "text" name = "username" autocomplete = "off"/><p>
Password: <input type = "password" name = "password" autocomplete = "off"/><p>
<input type = "submit" name = "submit" value = "login"/>

Source: forms

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.