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
https://forums.phpfreaks.com/topic/34147-php-redirect/
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
https://forums.phpfreaks.com/topic/34147-php-redirect/#findComment-160639
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
https://forums.phpfreaks.com/topic/34147-php-redirect/#findComment-160683
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.