Newb Question:

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
reprobation
Forum Newbie
Posts: 2
Joined: Mon Feb 05, 2007 1:26 am

Newb Question:

Post by reprobation »

Okay, I know I'm going to get flamed for this - but I actually did use the search function!
I haven't been using PHP long - about 6 hours actually.

I have a simple If/else statement.

The thing is,

if case 1 happens, I want the user to be forwarded to one url. ie: proceed.htm
if case 2 happens, I want the user to be forwarded to another url. ie: failure.htm

Here's my current statement:

Code: Select all

if (@mail($to, $subject, $message, $headers))
         echo "Message Sent";            <=== function to forward to proceed.htm here
      else
         echo "Failed to send";            <=== function to forward to failure.htm here
Thanks guys! Flame away! 8O

-Chris-
visitor-Q
Forum Commoner
Posts: 72
Joined: Mon Feb 05, 2007 1:40 am

Post by visitor-Q »

Code: Select all

<?php
        if($something){
                header("Location: http://www.yourdomain.com/proceed.htm");
        }else{
                header("Location: http://www.yourdomain.com/failure.htm");
        }
?>
google never hurt.


EDIT: code changed to correct header as of feyd's suggestion.
Last edited by visitor-Q on Mon Feb 05, 2007 9:38 am, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

The URL's need http:// too ;)
reprobation
Forum Newbie
Posts: 2
Joined: Mon Feb 05, 2007 1:26 am

Post by reprobation »

Awesome!

Thanks!

-Chris-
Post Reply