We’d like to remind Forumites to please avoid political debate on the Forum.

This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.

📨 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
  • 352.5K Banking & Borrowing
  • 253.7K Reduce Debt & Boost Income
  • 454.5K Spending & Discounts
  • 245.5K Work, Benefits & Business
  • 601.4K Mortgages, Homes & Bills
  • 177.6K Life & Family
  • 259.4K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16K Discuss & Feedback
  • 37.7K Read-Only Boards

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.