【发布时间】:2020-10-22 23:04:12
【问题描述】:
我正在编写一个 php 文件,我想在设置 get 变量时在现有 html 元素中显示不同的内容。
现在我想要设置单词“密码重置成功”而不是“输入您的电子邮件以重置密码”,或者通过隐藏当前的<p> 标签添加一个包含所需单词的新 <p> 标签GET 变量已设置。但我不知道如何做到这一点。我检查了不同的时间,但我失败了。如果有人可以帮助我做到这一点,我真的很感激。
这是我的代码。
<div class="login-box-body">
<!--Want to replace this text as Password Reset Was Success or add a new <p> tag containing the required words by hiding current <p> tag -->
<p class="login-box-msg">Enter your Email to reset the password</p>
<?php require '_inc/msg.php' ?>
<!-- Check if GET variable is set or not -->
<?php if (isset($_GET['code'])) {
echo '<style>.formPsw{ display:none;}</style>';
} ?>
<form action="" method="post" class="formPsw">
<div class="form-group has-feedback emailBox" >
<input type="email" name="email" class="form-control" placeholder="Email" data-validation="email required">
<span class="glyphicon glyphicon-envelope form-control-feedback"></span>
</div>
<div class="row">
<div class="col-xs-8">
</div>
<!-- /.col -->
<div class="col-xs-4 sendEmailBtn">
<input type="submit" name="send" class="btn btn-primary btn-block btn-flat" value="send"/>
</div>
<!-- /.col -->
</div>
</form>
<?php if (!empty($_POST['send'])) {
echo 'Please check your email ('.$_POST['email'].'). We send password reset link to your email.';
} ?>
</div>
【问题讨论】:
-
您可以使用js.innerHtml 方法来做到这一点。
-
@HamzaAbdaoui,但它使用 onload() 函数,我想要的是在设置 GET 变量后无需点击即可更改内容