Page 1 of 1

refreshing the page using php

Posted: Thu Apr 08, 2004 10:25 am
by sakaveli
hi,

my website is using Flash headers which point to php pages, the only problem is that once the browser has loaded the pages once, it doesnt load them again, so any changes do not show up unless the page is refreshed. if i change my internet settings to "refresh on every visit to a page" then my website works fine.

ive tried using meta tags but i dont think im using them right, all pages are being displayed through my index.php which is below:

Code: Select all

<?php
 	include("header.php");
	if ($page == "") {
		$page = "main";
	}
	echo "<meta http-equiv='refresh' content='0;URL=index.php'>"; 
	include("pages/".$page.".php");
	include("footer.php");
	mysql_close($db);	
?>
but that doesnt work, any ideas??

Posted: Thu Apr 08, 2004 10:46 am
by kettle_drum
As long as you place it at the top of the page before anything is sent to the user you can use:

Code: Select all

header('Location: http://www.google.com');
And if not, you can always use javascript:

Code: Select all

window.location='http://www.google.com';

Posted: Thu Apr 08, 2004 11:34 am
by sakaveli
thanks for the reply,
what does that code actually achieve? it looks like its redirecting to google?

i need my page to refresh everytime i click on a link, any idea?

Posted: Thu Apr 08, 2004 11:37 am
by markl999
You are using 'refresh' in the cache sense, not the redirecting sense which i think is causing the confusion.
Look at http://php.net/header , it has examples of forcing a page not to be cached, i think that's what you're after.

hi

Posted: Thu Apr 08, 2004 11:36 pm
by dipit
i think it will help u

<?php

// refresh / redirect to an internal web page
// ------------------------------------------
header( 'refresh: 5; url=/webdsn/' );
echo '<h1>You will be re-directed in 5 seconds...</h1>';


// refresh / redirect to an internal web page
// ------------------------------------------
header( 'refresh: 3; url=/' ); # redirects to our homepage
echo '<h1>You will be re-directed in 3 seconds...</h1>';


// refresh / redirect to an external web page
// ------------------------------------------
header( 'refresh: 0; url=http://www.example.net' );
echo '<h1>You won''t know what hit you!</h1>';
?>
_________________
let's work in a group.