Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IF ELSE and linking to another URL

Status
Not open for further replies.

TrueJoker

Technical User
Jun 14, 2006
115
GB
Is it possible once i have used an IF ELSE statement can i then make it link to a different page?

e.g.

if (!empty($_REQUEST['contact'])) {
$contact = stripslashes($_REQUEST['contact']);
} else {
$contact = Null;
echo '<p><font color="red"><b>You did not enter your Contact Name!</b></font></p>';
}

instead of it displaying a simple message syaing you did not enter..... can it be linked to another page where the error message is shown?

I have tried using a link function e.g.

link("
 
You can send headers that will redirect you to a new page. But you have to be sure to have absolutely no output (no html above the php, not even doctype, no print or echo statements, not even whitespace above the opening php bracket) before you issue header command.
Code:
else
{
    $contact = Null;
    header('Location: mynewURL.php');
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top