简体   繁体   English

单击 php 中的按钮后无法重新加载页面

[英]Not able to reload a page after clicking on a button in php

I am not able to reload the php page after a certain button is pressed.按下某个按钮后,我无法重新加载 php 页面。 That is there is no change until I reload the page by myself.在我自己重新加载页面之前,没有任何变化。 The php script is: php 脚本是:

<?php
// Initialize the session
session_start();

    if (($_SESSION['ShowGenerated'] == 'hidden'))
    {
        $class = 'hidden'; 
    }
    else if (($_SESSION['ShowGenerated'] == 'visible'))
    {
        $class = 'show'; 
    }   

?>

<html>
 <head>
....
<td><a href="Change.php" class="<?php echo $class; ?>" target="_blank"><button  id="pdf" name="Change" class="btn btn-primary"><i class="change-a"" aria-hidden="true"></i>Click Here</button></a></td>
...

On clicking "Click here" button, Change.php is called where $_SESSION['ShowGenerated'] value is generated.单击“单击此处”按钮后,将调用 Change.php 生成$_SESSION['ShowGenerated']值。 How do I load the current page or a URL to show a change?如何加载当前页面或 URL 以显示更改?

EDIT: Instead of reloading the whole page, can I only reload to check if the $_Session has changed in the html page?编辑:不是重新加载整个页面,我只能重新加载以检查 html 页面中的 $_Session 是否已更改?

Try to put tag inside:尝试将标签放在里面:

<button  id="pdf" name="Change" class="btn btn-primary"><i class="change-a"" aria-hidden="true"></i><a href="Change.php" class="<?php echo $class; ?>" target="_blank">Click Here</a></button>

like this像这样

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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