mcloan Posted February 22, 2008 Share Posted February 22, 2008 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 https://forums.phpfreaks.com/topic/92416-help-with-redirect-url-not-passing-variable/ Share on other sites More sharing options...
PHP Monkeh Posted February 22, 2008 Share Posted February 22, 2008 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 https://forums.phpfreaks.com/topic/92416-help-with-redirect-url-not-passing-variable/#findComment-473486 Share on other sites More sharing options...
mcloan Posted February 22, 2008 Author Share Posted February 22, 2008 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 https://forums.phpfreaks.com/topic/92416-help-with-redirect-url-not-passing-variable/#findComment-473492 Share on other sites More sharing options...
PHP Monkeh Posted February 22, 2008 Share Posted February 22, 2008 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 https://forums.phpfreaks.com/topic/92416-help-with-redirect-url-not-passing-variable/#findComment-473523 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.