如果单击链接,则Php将表单替换为另一个表单 [英] Php if link is clicked replaces a form with another

查看:85
本文介绍了如果单击链接,则Php将表单替换为另一个表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我试图用forgor密码替换我的登录表单如果单击链接而不将页面更改为另一个只是替换表单。它只是不会改变,这是我的链接



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

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





这是我的if声明





and here is my if statement

<?php
            if(isset($_GET['requestpasswordreset'])){
                include ('./Includes/Login/requestpasswordreset.php');
            }
            else {
                include ('./Includes/Login/login.php');
            }
        ?>

推荐答案

_GET [' requestpasswordreset'])){
include(' ./ Includes / Login / requestpasswordreset.php');
}
其他 {
include(' ./包括/登录/ login.php中);
}
>
_GET['requestpasswordreset'])){ include ('./Includes/Login/requestpasswordreset.php'); } else { include ('./Includes/Login/login.php'); } ?>


您可以实现所有目标在一个页面使用JavaScript,这里不需要PHP代码。请参阅下面的示例代码:

You can achieve your objective all in one page using javascript, php code is not needed here. See example code below:
<!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>


这篇关于如果单击链接,则Php将表单替换为另一个表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆