Hi, I have a comment form script, though it is written to go back to refresh the last page visited. But instead it just refreshes the page every 2 seconds. This is the code that I have at the moment:
[code]<?php
//Please set the following variables for your mysql database:
$db_hostname = “localhost”; //usually “localhost be default”
$db_username = “”; //your user name
$db_pass = “”; //the password for your user
$db_name = “”; //the name of the database
/MYSQL DATABASE CONNECTION/ TRACKING FUNCTIONS
--------------------------------------/
// connect to database
$dbh = mysql_connect ($db_hostname, $db_username, $db_pass) or die ('I cannot connect to the database because: ’ . mysql_error());
mysql_select_db ($db_name);
$tuturl = $_POST[“tuturl”];
$tutid2 = $_POST[“tutid2”];
$name = $_POST[“name”];
$url = $_POST[“url”];
$email = $_POST[“email”];
$message = $_POST[“message”];
$sendcomment = mysql_query(“INSERT INTO comments SET tutorialid=’$tutid2’, name=’$name’, url=’$url’, email=’$email’, comment=’$message’, date=now()”);
if($sendcomment){
//header(“Location: $tuturl”);
echo “
Submission Successful
”;echo “Your comment has been submitted. You will now be redirected back to the last page you visited. Thanks!”;
echo “”;
} else {
echo "There was an error with the submission. ";
}
?>[/code]
But the bit that I want to change is:echo "<meta http-equiv='refresh' content='2;URL=$tuturl'>";
because it is just refreshing the same page every 2 seconds. If you could help it would be great!
Thanks,
Ricky