📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!

PHP Redirection Help

I am trying to pass two variables from a link on a page and have the link visit certain pages / websites depending on the variables.

My code is below and is not working correctly.

Test2 works fine, and redirects, but Test fails to include the second PHP variable correctly and I don't have enough PHP knowledge to solve the problem myself.

Any help apprecaited :)

[php]<?php

// The link below is on my website and includes variables, static at the moment just for testing
// <a href="goto.php?site=Test&user=Username">Test</a>

$test = $_GET;
$site = $_GET;
if ($site == "") !!$link = "http://www.homepage.com/";}
if ($site == "Test") !!$link = "http://www.test.co.uk/'. $test .'";}
if ($site == "Test2") !!$link = "http://www.test2.co.uk/";}
header("Location: $link"); // Tells script to goto relevant link
exit();
?>[/php]

Comments

This discussion has been closed.
★ ★ ★ Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

Categories

  • All Categories
  • 355.9K Banking & Borrowing
  • 255K Reduce Debt & Boost Income
  • 456.2K Spending & Discounts
  • 248.4K Work, Benefits & Business
  • 606.1K Mortgages, Homes & Bills
  • 179K Life & Family
  • 263.9K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16.2K Discuss & Feedback
  • 37.7K Read-Only Boards
Quick Search

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.