Page 1 of 1

Newb Question:

Posted: Mon Feb 05, 2007 1:34 am
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-

Posted: Mon Feb 05, 2007 1:57 am
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.

Posted: Mon Feb 05, 2007 9:05 am
by feyd
The URL's need http:// too ;)

Posted: Tue Feb 06, 2007 12:46 am
by reprobation
Awesome!

Thanks!

-Chris-