Jump to content

PHP Redirect


warrenk

Recommended Posts

I am trying to perform a redirect with the following code...

<?php
if ($suppid == "" or $compid == "")
{$link = "http://www.yahoo.com";}
else
{$link = "http://www.yahoo.com";}
endif

header("Location: $link");
exit;
?>

When I run the page, it just sits on a blank screen.  Am I doing something wrong?  I know I have the same URL in my IF condition, this is for testing purposes only.

Thanks for any help!
Warren
Link to comment
Share on other sites

I don't know what I am doing wrong.  ??? I tried going to my page from a different computer (in case my redirect was being blocked) and still nothing.

By the way here is the page...

http://www.suppsearch.com/product.php

The code is now...

<?php
if ($suppid == "" or $compid == "")
{$link = "http://www.suppsearch.com"}
else
{$link = "http://www.suppsearch.com"}

header("Location: $link");
exit;
?>
Link to comment
Share on other sites

What about semicolons? You should also take out the $link out of the double quotes in the header():

[code]<?php

if ($suppid == "" || $compid == "")
$link = "http://www.suppsearch.com";
else
$link = "http://www.suppsearch.com";

header("Location: ".$link);
exit;

?>[/code]

Orio.
Link to comment
Share on other sites

I tried the code...

<?php

if ($suppid == "" || $compid == "")
$link = "http://www.suppsearch.com";
else
$link = "http://www.suppsearch.com";

header("Location: ".$link);
exit;

?>

Now the script just shows up on the page.  I think I may try a different host.

http://www.suppsearch.com/product.php

Warren
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.