Newbie PHP help

They have: 7 posts

Joined: Feb 2001

I am fairly new to PHP and the following is a script I found on http://php.resourceindex.com. It is a "Tell a friend" script which works perfectly but I need to change something, when the user hits the submit button it forwards them to a basic text page saying "thanks" this seems to be done by the ECHO section near the bottom of the script, I would like to change this so that it goes to a HTML/PHP page that I specify instead (friend_suc.html) :

You can see exactly how the script currently works by going to http://gd.project77.net/friend.php

<script language="php">
$nameX = stripslashes($name);
$to_nameX = stripslashes($to_name);
$url = "http://www.randomportal.com";
$message = "Hello $to_nameX,
I think you would like $url";
$subject = "$nameX wants you to check this site out";

if (( $to_email_address) && ( $from_email_address)) {

mail($to_email_address, $subject, $message,
"From: $from_email_address
Reply-To: $from_email_address
X-Mailer: PHP
Errors-To: $from_email_address");
echo "Thank you"; <---- This is what I want to change
} else {

echo "error";
}

</script>

They have: 850 posts

Joined: Jul 1999

change the line to
header("Location: friend_suc.html");

They have: 7 posts

Joined: Feb 2001

Thankyou very much

it worked exactly as I wanted it to

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

lol...
you may want to spell that all the way out
(friend_success.html instead of what it sounds like now) Wink

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.