Jump to content

[SOLVED] URL Variable Problems from Redirect Page


BoarderLine

Recommended Posts

Hi.  I have a hyperlink

 

<a href="Train_Direct.php?recordID=<?php echo $row_rsTrains['trainID']; ?>&dtl=<?php echo $row_rsTrains['train_dtlID']; ?>">VIEW</a>

 

Which is redirecting the user depending on their browser resolution:- this is the content of Train_Direct.php.

 

<?php

function setUrlVariables() {
  $arg = array();
  $string = "?";
  $vars = $_GET;
  for ($i = 0; $i < func_num_args(); $i++)
    $arg[func_get_arg($i)] = func_get_arg(++$i);
  foreach (array_keys($arg) as $key)
    $vars[$key] = $arg[$key];
  foreach (array_keys($vars) as $key)
    if ($vars[$key] != "") $string.= $key . "=" . $vars[$key] . "&";
  if (SID != "" && SID != "SID" && $_GET["PHPSESSID"] == "")
    $string.= htmlspecialchars(SID) . "&";

  return htmlspecialchars(substr($string, 0, -1));
}

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Stuff2do - Redirect</title>
<script language="Javascript">

if (screen.width <= 1023) {
document.location = "Training.php<?php echo setUrlVariables(); ?>";
}

if (screen.width > 1024) {
document.location = "Training_Display.php<?php echo setUrlVariables(); ?>";
}

</script>
</head>

<body>
</body>
</html>

 

However when redirected to the final page the URL Variables are no longer separated with the & symbol they are replaced with &.

 

Can anyone please help me with why this may be happening?  I have tried using & and also %26 in the original link however still no luck.  Also urlencode() used in the redirect page also gave no joy :-(

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.