1

I have a page that needs to be constantly refreshed multiple times a minute. The page has is a echo'd php table. 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 :

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:

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>";
}
2
  • Can you include the code that you use to display the "Start Session" buttons? Commented Jan 8, 2013 at 20:38
  • Thank you. I updated my answer accordingly. Commented Jan 8, 2013 at 20:54

3 Answers 3

2

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. It should refresh the page.

<input type='submit' name='submit' value='Start Session' onClick="window.location.reload()" />
Sign up to request clarification or add additional context in comments.

2 Comments

Right I have done that, however when I hit the start session button the page stops resetting. I am inputting a form and then the page stops refreshing period.
Did not work. I tried this at the end of my code : $page = "inoffice.php"; $sec = "10"; header("Refresh: $sec; url=$page"); and still nothing .
0

Is it possible for you to use Javascript to achieve the desired effect? 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.

Comments

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

or

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

3 Comments

What will form action have to do with anything? My form action leads to the script with my input statements. What I am confused about is actually refreshing the page after the form is submitted.
The form action is the page that you are redirected to when you submit that form. If the action is the current page, it gives your desired "refresh" effect.
right but the form action is another page that is a an actual url page that is needed. not just a script. its an open url redirect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.