0

i have created a login form,with username and password .when i start typing the username suppose i have typed the first letter "a" then a lot of username starting with "a" appears below the textbox how can i clear this data. I found that we can clear out by using the browser settings like going to tools ->clear browsing data ->delete cookies,empty the cache , but i would like to know whether there is any way i can find a solution using programming.

i will be happy if you confirm whether the solution i found is correct or wrong (this one( tools ->clear browsing data ->delete cookies,empty the cache) ).

I found out a solution from the forum for programming ,i am keen on knowing the above solution

<?php
// Initialize the session.
// If you are using session_name("something"), don't forget it now!
session_start();

// Unset all of the session variables.
$_SESSION = array();

// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (ini_get("session.use_cookies")) {
$params = session_get_cookie_params();
setcookie(session_name(), '', time() - 42000,
$params["path"], $params["domain"],
$params["secure"], $params["httponly"]
);
}

// Finally, destroy the session.
session_destroy();
?>
hjeg
  • 1
  • 2

2 Answers2

3
<input type="text" name="foo" autocomplete="off" />

Just need to turn off your browsers auto complete feature!!!that`s it

Refer this-->Is autocomplete="off" compatible with all modern browsers?

Community
  • 1
  • 1
HIRA THAKUR
  • 17,189
  • 14
  • 56
  • 87
  • does it will be cleared if the we clear the cache as i mentioned in the question,also does the method suggeted by you works for all browsers – hjeg Jun 25 '13 at 11:39
  • Dont worry!!!it will take care of every thing,it is cross browser compatible. http://stackoverflow.com/questions/393882/cross-browser-techniques-for-disabling-password-caching – HIRA THAKUR Jun 25 '13 at 11:41
  • one more question,its not programming so i would like to know the pupses of these thing in browser->tools->clear browsing data Empty the cache,Delete cookies and other site and plug-in data,Clear saved Autofill form data.thank you – hjeg Jun 25 '13 at 11:45
  • i guess google is the right place for such question.Just type the search term properly and you will get plenty of info. It will take some reading,wont be possible in commentbox!!! Click on the right option if you think its worthy of it. – HIRA THAKUR Jun 25 '13 at 11:47
0

Set the autocomplete attribute of an input text to off like this:-

<input type="text" autocomplete="off" ............ />
Vivek Sadh
  • 4,230
  • 3
  • 32
  • 49