Jump to content

Passing/getting a variable


bali2003

Recommended Posts

Hi guys hope you can help me.

this string:

 

<a href="{$article.link}?tid=<? echo $_GET['kw']; ?>">

 

produces this output:

http://articlelink.php/?tid=<? echo $_GET['kw']; ?>

 

for some reason the variable 'kw' is not transfered from the link: http://link.php?kw=whatever

 

Any help?

Link to comment
https://forums.phpfreaks.com/topic/190035-passinggetting-a-variable/
Share on other sites

The $article vars displays OK but the get inside the short tags does not. Why if the $article vars needs no short tags does the get need them? There's more than meets the eye here. Some kind of template engine? Read the docs.

 

<a href="{$article.link}?tid=<? echo $_GET['kw']; ?>">

 

 

HTH

Teamatomic

well, one thing to try is using proper PHP tags rather than short tags. short tag support was left off by default as of PHP 5, and will probably not even exist in PHP 6:

 

<a href="{$article.link}?tid=<?php echo $_GET['kw']; ?>">

 

in addition, are your template files given the .php extension? if not, the PHP won't be parsed (unless your server has additional extensions set to parse as PHP).

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.