hjeg
hjeg

Reputation: 1

values comes up in textbox on typing something

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();
?>

Upvotes: 0

Views: 1409

Answers (2)

Vivek Sadh
Vivek Sadh

Reputation: 4268

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

<input type="text" autocomplete="off" ............ />

Upvotes: 0

HIRA THAKUR
HIRA THAKUR

Reputation: 17767

<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?

Upvotes: 3

Related Questions