We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

PHP codes dont wanna update and display the new stuff

darenceang
darenceang asked
on
Medium Priority
204 Views
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.
Cheers!
Darence
Comment
Watch Question

Stacy SpearPresident/Principal Consultant

Commented:
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");
}
?>

Commented:
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!
Commented:
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>');

?>

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.