Restrict browser not to auto populate email and password - php

I have a login form as below:
<form name="checkform" action="example.php">
<input type="text" id="c_email" name="c_email" placeholder="EMail here">
<input type="text" id="c_epass" name="c_epass" placeholder="Password here">
<input type="submit" id="c_sub">
</form>
Now when i use this form to Login and then browser ask to save password. I clicked yes and those are saved in browser. But i do not want to auto populate these details everytime i open the page to login.
How can i restrict not to auto populate these details? I want that if user fills email id then only saved password shall populate otherwise those fields should remain empty.

<form name="checkform" action="example.php" autocomplete='off'>
<input type="text" id="c_email" name="c_email" placeholder="EMail here">
<input type="text" id="c_epass" name="c_epass" placeholder="Password here">
<input type="submit" id="c_sub">
</form>

Use autocomplete="off" in inputbox:
<form name="checkform" action="example.php" autocomplete="off">
<input type="text" id="c_email" name="c_email" placeholder="EMail here">
<input type="text" id="c_epass" name="c_epass" placeholder="Password here">
<input type="submit" id="c_sub">
</form>
Reference is here.

Related

password attribute filling unwanted usernameand password

I'm trying to create a login page in php.
I got the form and the login verificaion works fine but when i go to my index.php which is my log in page, the login credentials are auto filled with unwanted credentials like below.
Whereas my login paage should look like this..
My form is as below:
<form action="check_login.php" method="post">
<label id="uname">User Name: </label><input type="text" placeholder="Enter Username" name="uname" required="required"> <br>
<label id="psw">Password: </label><input type="password" placeholder="Enter Password" name="psw" required="required"> <br> <br>
<button type="submit" name="login">Login </button>
</form>
When I use type=text it works fine..
I've also tried autocomplete="off", but it doesn't work...
What am I doing wrong? I'm a newbie... Please help me...
change
<input type="text" placeholder="Enter Username" name="uname" required="required">
with
<input type="text" placeholder="Enter Username" name="uname" required="required" autocomplete="off" />
it is browser feature to auto fill the form
"Autofilling" a form is a browser feature. You can turn it off for a form using the autocomplete attribute (setting it to off). Change your form to
<form action="check_login.php" method="post" autocomplete="off">
<label id="uname">User Name: </label><input type="text" placeholder="Enter Username" name="uname" required="required"> <br>
<label id="psw">Password: </label><input type="password" placeholder="Enter Password" name="psw" required="required"> <br> <br>
<button type="submit" name="login">Login </button>
</form>
There might be cases where autocomplete="off" is set, but the browser still fills in your form details. The "trick" is to set autocomplete to an invalid value, like autocomplete="kerbholz".
I got it...removed the user from saved logins from my browser.... And it works fine...

Html form works fine on computer but submit button doesnt work on Mobile Phones

Here's a simple html form code using php and POST method. It works fine on Computers but the submit button doesn't work on Mobile phones. It doesn't click when we touch it.
<form action="contact2.php" method="POST">
Your name:<br>
<input name="name" size="30" type="text" /><br> Your mobile no:<br>
<input name="phone" size="15" type="text" /><br> Your email:<br>
<input name="email" size="30" type="text" /><br> Your message:<br>
<textarea name="msg" rows="7" cols="30">
</textarea><br />
<input class="formsubmit" type="submit" value="Send Email" />
</form>
Try to use button tag instead of input
<button class="formsubmit" type="submit">Send Email</button>

I need a form not to clear the fields during a submit for test mode

I'm writing a php form that has a button to test the database connection before proceeding to the next step. The only problem is that running the test, clears the fields. I can put onsubmit="return false" at the top of the form, but then the test works fine, but I can't submit the form for its real purpose then. I'm guessing this could be fixed with javascript, but I'm a total noob there and I'm wondering if there is a PHP/HTML way to accomplish this.
Here's the form. The test button runs a test pdo connection and gives feedback and the "Next Step >>" button writes the configuration to a file and goes on to the next step.
<H2>Please fill in your database credentials</H2>
<form class="form" action="" onsubmit="return false" method="post">
<label for="dbh">Database Host
<input class="form-control" type="text" name="dbh" value=""></label>
<br><br>
<label for="dbu">Database User
<input class="form-control" type="text" name="dbu" value=""></label>
<br><br>
<label for="dbp">Database Password
<input class="form-control" type="text" name="dbp" value=""></label>
<br><br>
<label for="dbn">Database Name
<input class="form-control" type="text" name="dbn" value=""></label>
<br><br>
<input class="btn btn-success" type="submit" name="test" value="Test Settings">
<input class="btn btn-primary" type="submit" name="submit" value="Next Step >>">
</form>
You need to write in $_POST vars in your inputs.
<label for="dbh">Database Host
<input class="form-control" type="text" name="dbh" value="<? if ($_POST['dbh']){ print $_POST['dbh']; } ?>"></label><br><br>
<label for="dbu">Database User
<input class="form-control" type="text" name="dbu" value="<? if ($_POST['dbu']){ print $_POST['dbu']; } ?>"></label><br><br>
<label for="dbp">Database Password
<input class="form-control" type="text" name="dbp" value="<? if ($_POST['dbp']){ print $_POST['dbp']; } ?>"></label><br><br>
<label for="dbn">Database Name
<input class="form-control" type="text" name="dbn" value="<? if ($_POST['dbn']){ print $_POST['dbn']; } ?>"></label><br><br>

Html form tag autocomplete="off" attribute not working on chrome browser

I have user registration form. Form contains username and password field.
At the time of user registration username and password fields automatically populated values.
I have used form "autocomplete" attribute, but not working on chrome browser.
This is my code,
<form method="post" action="" autocomplete="off">
<input type="text" id="first_name" name="first_name">
<input type="text" id="last_name" name="last_name">
<input type="text" id="username_name" name="username_name">
<input type="text" id="password" name="password">
In my experience, Chrome only autocompletes the first <input type="password"> and the previous . So I added:
<input style="display:none">
<input type="password" style="display:none">
To the top of the <form> and the case was resolved.

wordpress login issue

i have created a custom popup login box. and use form settings like that
<form action="<?php bloginfo('url'); ?>/wp-login.php?redirect_to=<?php echo urlencode($_SERVER['REQUEST_URI']); ?>" method="post" autocomplete="off">
and i use input feilds like that
<input id="login_username" name="user_name" type="text" value="" class="pop-input surfix" /><span id="placeholder_user_login">Username</span>
<input id="login_password" name="user_password" type="password" value="" class="pop-input" /><span id="placeholder_user_pass">Password</span>
<input id="register" type="submit" value="Login" class="popup-login-btn" />
but it redirecting to wp-login.php except it should process the login and redirect to the pages where from user started login.
please guide me how can i fix this.
thank you all
actually the issue was with the name element of the input field.
When i check the wp-login.php page i discover the wordpress changes the name of input fields.
<input id="login_username" name="user_name"
<input id="login_password" name="user_password"
to
<input id="login_username" name="log"
<input id="login_password" name="pass"
So i just simply replace the names and all issues were sorted out.
Thank you all

Categories