Monday, September 6, 2010

How to Turn off Form AutoCompletion

We can off the Auto Completion in web form by following way.

1. Set autocomplete="off" in input box.


<input type="text" name="cc" autocomplete="off" />
 
 
2.  Set autocomplete="off" in Form Tag.
 
 
3. The Best way I prefere
First page ( HTML Form ) : 

<form method="post"> 
<input type="hidden" name="username" value="random1"> 
<input type="hidden" name="password" value="random2"> 
Username: <input type="text" name="random1" value=""><br />
Password: <input type="password" name="random2" value="">
</form>

Where "random1" and "random2" are random names generated, you can use in combination with unix time.

Second page ( PHP output ) :
<?php
if ( isset($_POST['username'], $_POST['password']) && isset($_POST[$_POST['username']], $_POST[$_POST['password']]) ) { echo 'Username: '.$_POST[$_POST['username']].'<br />'. 'Password: '.$_POST[$_POST['password']]; }
?> 


Sourece: Web Search
 

No comments:

Post a Comment