[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 188
  • Last Modified:

PHP codes dont wanna update and display the new stuff

Hi Experts!
I have 3 php pages...
One is album.php ( where it shows all the albums )
One is create_album.php ( for creating album )
One is create_album_code.php ( the code behind for the form post of create_album.php )

When i create an album and click the submit button,
it is redirected to create_album_code.php where it process the stuff.. add in the MYSQL tables..
then redirect me to create_album.php with an alert box saying its been created.

When i go back to the album.php
I dont see the new album ( it is created inside the sql )
I have to close the IE window, open another new one...
Login to the site, go to album.php
THEN i can see the new album...

Any adivce on why its this way?
Why is it when i tried to go back to the album.php..
it wont work?

Please advice.
Cheers!
Darence
0
darenceang
Asked:
darenceang
1 Solution
 
Stacy SpearCommented:
You are probably being cache. While holding the control key, press F5 and see if it does refresh.

I use this in an external file that I reference with each script to avoid the cache.

<?php
if (!headers_sent()) {
      // Date in the past
      header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

      // always modified
      header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");

      // HTTP/1.1
      header("Cache-Control: no-store, no-cache, must-revalidate");
      header("Cache-Control: post-check=0, pre-check=0", false);
      
      // HTTP/1.0
      header("Pragma: no-cache");
}
?>
0
 
orbic1Commented:
shift + refresh button on a mac.

OR

are you clicking "Back" in your browser or redirecting back to album.php? You should be doing the latter!
0
 
dkaislaCommented:
Hi Darence,

Try to include a javascript after you have processed the insert query in your file create_album_code.php  so that the user will be redirected to album.php with the fresh data visible on your list of albums.

<?php

echo('<script language="javascript">');
echo('window.location = "album.php";');
echo('</script>');

?>
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now