Briggs
03-17-2008, 05:28 AM
Hey, I'm using the script found here
http://www.zimmertech.com/tutorials/php/25/comment-form-script-tutorial.php
down in the third part
<?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 "<h1>Submission Successful</h1>";
echo "Your comment has been submitted. You will now be redirected back to the last page you visited. Thanks!";
echo "<meta http-equiv='refresh' content='2;URL=$tuturl'>";
} else {
echo "There was an error with the submission. ";
}
?>
the redirect is kinda weird, it isn't working :p
I know absolutely almost nothing about php
how do I change the redirect to be the page you placed the comment?
Thanks,
Briggs
http://www.zimmertech.com/tutorials/php/25/comment-form-script-tutorial.php
down in the third part
<?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 "<h1>Submission Successful</h1>";
echo "Your comment has been submitted. You will now be redirected back to the last page you visited. Thanks!";
echo "<meta http-equiv='refresh' content='2;URL=$tuturl'>";
} else {
echo "There was an error with the submission. ";
}
?>
the redirect is kinda weird, it isn't working :p
I know absolutely almost nothing about php
how do I change the redirect to be the page you placed the comment?
Thanks,
Briggs