How do we create a link to another page after the submit?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
joseph
Forum Newbie
Posts: 24
Joined: Mon Jul 03, 2006 6:15 am

How do we create a link to another page after the submit?

Post by joseph »

This codes below is a portion of what I've pasted from my feedback.php . I already have the $headers declared above,
it means that I can't use another header function below.. so what should I do to redirect to another page after the feedback form is sent?

Code: Select all

$headers   = "From: $FirstName $LastName \r\n";
$headers  .= "Reply-To: $Email";

if (mail($recipient,$subject,$message,$headers)) {
 headers ("Location: http://www.name.html");
} else {
   echo "<p>I'm sorry $Title $FirstName $LastName, Mail NOT sent this time.</p>";   
}
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Erm, that shouldn't make a difference. However, the function is named wrong: it's header().
joseph
Forum Newbie
Posts: 24
Joined: Mon Jul 03, 2006 6:15 am

Post by joseph »

Ambush Commander wrote:Erm, that shouldn't make a difference. However, the function is named wrong: it's header().
:D could you give me an example? I can't seem to make it work redirect it after mail has been sent. It has to redirect to another html page saying that the mail has been sent.
bdlang
Forum Contributor
Posts: 395
Joined: Tue May 16, 2006 8:46 pm
Location: Ventura, CA US

Post by bdlang »

I'm assuming that's an example, because the domain http://www.name.html isn't going to work, it should be http://www.name.com/page.html

Code: Select all

if ( something good happened ) {
    header("Location: http://www.name.com/page.html");
} else {
    echo 'something bad happened, unfortunately.';
}
joseph
Forum Newbie
Posts: 24
Joined: Mon Jul 03, 2006 6:15 am

Post by joseph »

bdlang wrote:I'm assuming that's an example, because the domain http://www.name.html isn't going to work, it should be http://www.name.com/page.html

Code: Select all

if ( something good happened ) {
    header("Location: http://www.name.com/page.html");
} else {
    echo 'something bad happened, unfortunately.';
}
Thanks but it still has the error, it says that the heads is already declared above. Something like that since I already have $headers. Maybe I could just put a link instead.. like

echo 'mail sent successfully';
<a href=" ">www.site.com </a>
Post Reply