Use href to submit into a php file

<p>I want to make a login form which should provide 2 ways to submit , one through the login button which should submit the info into the login.php and another through the href (Forgot password) which should redirect the user and submit the info to the forgotpassword.php file. So far I have tried this code but it doesn't work:</p><pre><br /><code><script type="text/javascript"><br />function forgotpassword()<br />{<br /><br />document.getElementById("ee").action="project_forgotpassword.php";<br />document.getElementById("ee").submit();<br /><br />} <br /></script><br /><form id="ee" method="POST" action="login.php"><br /><table><br /><tr><br /><th>Username</th><br /><td><input type="text" name="username"></td><br /></tr> <br /><tr><br /><th>Password</th><br /><td><input type="password" name="password"></td><br /></tr><br /><tr><br /><th><a href="project_forgotpassword.php" onClick="javascript: forgotpassword();">Forgot Password</a></th><br /></tr><br /><tr><br /><td></td><br /><td><br /><input type="submit" name="submit" value="Submit"><br /></td><br /></tr> <br /></table><br /></form><br /></code><br /></pre><br /><h2>Click here view more answers <a href="%20http://stackoverflow.com/questions/34470157/use-href-to-submit-into-a-php-file">http://ift.tt/1NGBFb8</a></h2>

Nhận xét

Bài đăng phổ biến từ blog này

Align div to bottom of the page in bootstrap

Align elements inside an tag vertically

Javascript is unable to stop page loading