Ready, steady… save!
You don’t need a chart to join in. Here are 2 ways to record your savings:
1. Cross it off
Pop a chart into your first post. Saved an amount? Cross it out! Read more »
£0.01 £0.02 £0.03
2. Write it down
Skip the chart and add updates to your first post. Read more »
“Another +£3 saved today. Go me!”
Use +£ before each new saving so it counts towards your total.
📨 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
MBNewB
Posts: 151 Forumite
in Techie Stuff
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]
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]
0
Comments
-
What error does it give, or does it pass the URL as something like http://www.test.co.uk/%20test ?
Try
if ($site == "Test") !!$link = "http://www.test.co.uk/".$test.;}
JoelFreeBSD | Microsoft | Linux Nerd
GNU-PG Key-ID: 0xCBC2F26D
BSc MBCS MCP0 -
That's the one...
I will try your variation later today when I get home and let you know. Thanks for the help
0 -
What error does it give, or does it pass the URL as something like http://www.test.co.uk/ test ?
Try
if ($site == "Test") !!$link = "http://www.test.co.uk/".$test.;}
Joel
Sorry,
It should be if ($site == "Test") !!$link = "http://www.test.co.uk/".$test ;}
Without the extra .
Joel
FreeBSD | Microsoft | Linux Nerd
GNU-PG Key-ID: 0xCBC2F26D
BSc MBCS MCP0 -
Thanks Joel, worked a treat

Now to learn how to implement that into links within joomla! lol
Thanks again!0 -
Hi, guys
Free and opensource php redirection script I found at PHPKode.com0
This discussion has been closed.
Confirm your email address to Create Threads and Reply
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