PHP codes dont wanna update and display the new stuff

Posted on 2007-07-20
Last Modified: 2013-12-13
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.
Question by:darenceang
    LVL 23

    Expert Comment

    by:Stacy Spear
    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.

    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");
    LVL 4

    Expert Comment

    shift + refresh button on a mac.


    are you clicking "Back" in your browser or redirecting back to album.php? You should be doing the latter!
    LVL 4

    Accepted Solution

    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.


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


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
    Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now