简体   繁体   中英

Pulling or Auto Populate A Form Input Field

Ok i am trying to find if this is possible, i have a single page that has two login forms. But uses the same username and password. Is it possible whereas once i log into one form my username is pulled from the from that already has my username and the password is pulled from the database?

<form action="home.php" method="post" id="LoginForm" style="color:#FFF">
<input type="hidden" name="SessionID" value="new"></input>
Username:
<input type="text" name="AccountNo" value="" class="input" size="28"></input>
<BR /><BR />
&nbsp;&nbsp;Password:
<input type="password" name="Password" value="" class="input" size="30"></input>
<BR />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="image" src="images/input-img.gif" value="Log On" class="input-img"></input>
<BR /><br />
<a href="#" class="link" style="font-size:12px;">Register now!</a>   <a href="#" style="font-size:12px;">Forgotten your password?</a>
</form>

If your question is whether it is possible, then answer is yes it is possible.

After you submit the form, you can use JavaScript to read the username from first form and populate it in the second form. To get password, you can AJAX.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM