简体   繁体   English

提交按钮后刷新PHP页面-PHP-MySQL

[英]Refreshing a php page after submit button - PHP - MySQL

I have a page that needs to be constantly refreshed multiple times a minute. 我的页面需要每分钟不断刷新多次。 The page has is a echo'd php table. 该页面具有一个echo'd php表。 Preivew

The page loads perfectly fine, all is good, I have used the META tag HTML, I have used the header tag with the refresh function in PHP... and yet a problem arises : 该页面加载得很好,一切都很好,我使用了META标签HTML,我使用了带有PHP刷新功能的标头标签...但是出现了一个问题:

When I hit Start Session button the refresh stops. 当我点击开始会话按钮时,刷新将停止。 And the table bellow does does not get updated. 并且下面的表不会更新。 So then I have to manually refresh the page. 因此,我必须手动刷新页面。 This is not the desired affect. 这不是所需的影响。 Can some one explain to me how to refresh a page continually. 有人可以向我解释如何连续刷新页面。

Edit 1: 编辑1:

Code that makes the include of the session start 使会话开始包含的代码

foreach($result as $row)
    {
  echo "<tr>";
  echo "<td>" . $row['id'] . "</td>";
  echo "<td> <a href=student.php?anum=" . $row['anum'] . " target='_blank'>" .$row['anum'] . " </a></td>";
  echo "<td>" . $row['first'] . "</td>";
  echo "<td>" . $row['last'] . "</td>";
  echo "<td>" . $row['why'] . "</td>";  
  echo "<td>" . $row['comments'] . "</td>";
  echo "<td>" . $row['additional_req'] . "</td>";
  echo "<td>" . $row['signintime'] . "</td>";
  echo "
        <td>    <form action='counselor.php?id=" . $row['id'] . "' method='post' target='_new'>
                    <select name='namedrop'>
                        <option value=''>Counselor Name</option> 
                        <option value='Admin-John'>Admin - John</option>
                        <option value='Admin-Christine'>Admin - Christine</option>
                        <option value='Admin-Dawne'>Admin - Dawne</option>
                        <option value='Counselor-Cherie'>Counselor - Cherie</option>
                        <option value='Counselor-Tootie'>Counselor - Tootie</option>
                        <option value='Counselor-Debbie'>Counselor - Debbi</option>
                        <option value='FrontDesk-Delores'>Front Desk - Delores</option>
                        <option value='FrontDesk-Kiana'>Front Desk - Kiana</option>
                    </select>
            </td>

            <td> <input type='submit' name='submit' value='Start Session'></td>
            </form> </td>";
}

If you are looking to refresh the page when you click "Start Session", then you can edit your submit button to have this onClick listener. 如果您在单击“开始会话”时希望刷新页面,则可以编辑提交按钮以使用此onClick侦听器。 It should refresh the page. 它应该刷新页面。

<input type='submit' name='submit' value='Start Session' onClick="window.location.reload()" />

Is it possible for you to use Javascript to achieve the desired effect? 您是否可以使用Javascript达到理想的效果? I don't know enough about what you're doing to determine whether that would clear your changes or not (my assumption here is: no). 我对您正在做的事情一无所知,以确定是否能清除您的更改(我的假设是:否)。

If you are able to use Javascript, you could write a simple function which refreshes the page on an interval. 如果您能够使用Javascript,则可以编写一个简单的函数来按间隔刷新页面。

<form action="<?php echo $PHP_SELF; ?>" method="post">  

要么

<form action="thispage.php" method="post">  

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

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