Hi,
I am trying to redirect links through a php redirect. I am just about there but am having problems with the coding to pass the variable through from my page to the php script.
For example link on my page is:
http://www.website.co.uk/redirect.php?m=196591.html
This should display the page for HotelID 196591, the url of which is stored in a database.
The code for the redirect.php script I'm using is:
<?php
include 'connect.php';
$m = $_GET['m'];
$result = mysql_query("SELECT HotelID, HotelUrl FROM databasename ");
while ($row = mysql_fetch_array($result)) {
if ($m == ".$row{'HotelID'}.") {$link = ".$row{'HotelUrl'}.";}
}
header("Location: $link");
exit();
?>
It works if I hard code HotelID and HotelUrl into the 'if' statement, but am looking to have the HotelID variable carried through from the web page so I don't need to hard code thousands of pages into the script.
Hope somebody can help.
Thanks, Gordon