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>

Link to comment
Share on other sites

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; ?>

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.