Just write this at the bottom of your php files (like mentioned previously):
<?php header("Location:htmlcode.html");exit; ?>
or for more generic return code (it will return you to the previous page):
<?php header("Location:{$_SERVER['HTTP_REFERER']}");exit; ?>
You MUST ensure that no text (error messages or echoed php or any HTML) is output to screen before the header function is called or you will get an error.
diafol
Rhod Gilbert Fan (ardav)
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
$output = bla blah bla; /* the data output from the background php page. I had to put SOMETHING here, */
$getdate = date( 'd-m-Y, H:i:s' );// Get the date.
$user_ip = $_SERVER['REMOTE_ADDR'];// Get the user IP, just in case.
$referer = getenv("HTTP_REFERER");// Get the refering page. just in case
$file = "./your path to logfile/logfile.csv"; /*define the file as required, csv opens easily in excell or imports to sql if REQ, but is really just a text file.*/
$fp = fopen($file, "a+"); //open the text file for writing.
// Write into the text file.
fputs ($fp, "$getdate, $user_ip, $referer, $output\n"); //see note after $output definition above
fclose($fp);// Close the text file.
create a blank text file logfile.csv (or whatever), this scrap is just an appendage to the existing page, not optimized, just an example, there can be any number of data fields to comprise $output
almostbob
Posting Sensei
3,149 posts since Jan 2009
Reputation Points: 571
Solved Threads: 376
Nice tutorial link. I agree if you don't want to leave/return to the html page, use Ajax. I use prototype myself and it's REALLY easy, and I don't even do JS that well.
diafol
Rhod Gilbert Fan (ardav)
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080