Click here to Skip to main content
15,905,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi there im trying to replace my login form with forgor password if link is clicked with out changing the page to another just replace form. it just will not change, here is my link

HTML
<a href="<?php echo URL; ?>Includes/Login/requestpasswordreset">Forgot my Password</a>


and here is my if statement

C#
<?php
            if(isset($_GET['requestpasswordreset'])){
                include ('./Includes/Login/requestpasswordreset.php');
            }
            else {
                include ('./Includes/Login/login.php');
            }
        ?>
Posted
Updated 21-Dec-13 13:44pm
v2

1 solution

You can achieve your objective all in one page using javascript, php code is not needed here. See example code below:
XML
<!DOCTYPE html>
<html>
<body>
<form id="loginForm" style="display:block">
<p>this is login form</p>
<input type="button" id='reset' value="Reset password" onclick='changeForm(this)' />
</form>
<form id="resetForm" style="display:none">
<p>this is reset form</p>
<input type="button" id='login' value="Goto login" onclick='changeForm(this)' />

</form>

<script>
function changeForm(e){

   var whichButton = e.id;

   if (whichButton == 'reset'){
       document.getElementById('loginForm').style.display="none";
document.getElementById('resetForm').style.display="block";

   } else {

document.getElementById('loginForm').style.display="block";
document.getElementById('resetForm').style.display="none";       }

}
</script>

</body>
</html>
 
Share this answer
 
v4
Comments
Er. Tushar Srivastava 22-Dec-13 7:39am    
Initially, the blocks should be hidden using display: none in css and then revealing it on page load complete action $(document).ready(function(){}); This will generate neat html page in browser while the site is loading on a slow internet connection :)
Nico_Travassos 22-Dec-13 10:34am    
i am trying not to use jquery do you not have a solution for php
Peter Leow 22-Dec-13 10:36am    
There is no jquery only plain javascript in my code example.
If you use php, it has to make a round trip to the server because php code has to be executed at the server. There is no need to. Just use javascript which is executed on your browser.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900