Jump to content

Help with redirect url not passing variable


mcloan

Recommended Posts

I have the below code but I can not get the last part of the redirect url ($strKeyword=<?php echo($_REQUEST['ad']); ?>) to pass on the redirection.  It just comes up blank.  When I echo it up top it reads the value to the screen but in the last part of the meta http-equiv="Refresh" it will not pass.

 

Does anyone know how I can get around this and get it to pass with the url in the redirect?

 

Thank you.

 

 


<!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">
$strKeyword=<?php echo($_REQUEST['ad']); ?>

<?php echo($strKeyword);?>

<head>
<meta http-equiv="Refresh" content="0;URL=http://www.mysite.com/r/aff/af=p40XX5&ag=<?php echo($strKeyword);?>">
<title>Repair Your Credit Today - Lexington Law</title>
</head>
<body>
</body>
</html>

Well according to that meta refresh the variable you're passing is called "ag", and you're trying to echo "ad".  Plus, change $_REQUEST to $_GET, like so:

 

<?php echo $_GET['ad']; ?>

 

And you don't have your first $strKeyword within PHP, you're just outputting it to the browser, so your second attempt at echo-ing $strKeyword will of course come up blank.  Try this:

 

<?php $strKeyword = $_GET['ad'];

echo $strKeyword; ?>

Well according to that meta refresh the variable you're passing is called "ag", and you're trying to echo "ad".  Plus, change $_REQUEST to $_GET, like so:

 

<?php echo $_GET['ad']; ?>

 

And you don't have your first $strKeyword within PHP, you're just outputting it to the browser, so your second attempt at echo-ing $strKeyword will of course come up blank.  Try this:

 

<?php $strKeyword = $_GET['ad'];

echo $strKeyword; ?>

 

I was totally was missing the ad, thank you. I implemented your suggestion like the below, but then page does not redirect at all with the below code.  Any further suggestions would be much appreciated.

 


<!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">

<?php $strKeyword = $_GET['ad'];

<head>
<meta http-equiv="Refresh" content="0;URL=http://www.mylink.com/r/xxx/af=p40dd25&ad=echo $strKeyword ;?>">
<title>Repair Your Credit Today - Lexington Law</title>
</head>
<body>
</body>
</html>

You still need the opening PHP tags in your meta refresh.

 

<meta http-equiv="Refresh" content="0;URL=http://www.mylink.com/r/xxx/af=p40dd25&ad=<?php echo $strKeyword ;?>">

 

And don't forget to close the PHP tags after $_GET['ad'];

 

Your code should look like this:

 

<!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">

<?php $strKeyword = $_GET['ad']; ?>

<head>
<meta http-equiv="Refresh" content="0;URL=http://www.mylink.com/r/xxx/af=p40dd25&ad=<?php echo $strKeyword; ?>">
<title>Repair Your Credit Today - Lexington Law</title>
</head>
<body>
</body>
</html>

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.