Passing/getting a variable

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bali2002
Forum Newbie
Posts: 3
Joined: Wed Jan 27, 2010 2:29 pm

Passing/getting a variable

Post by bali2002 »

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?
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Passing/getting a variable

Post by AbraCadaver »

Most likely your file is .htm or .html? Try changing to .php. Most webservers don't parse .htm, .html files with PHP by default.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
bali2002
Forum Newbie
Posts: 3
Joined: Wed Jan 27, 2010 2:29 pm

Re: Passing/getting a variable

Post by bali2002 »

No sorry I've already changed to .php
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Passing/getting a variable

Post by AbraCadaver »

bali2002 wrote:No sorry I've already changed to .php
Actually, on second look, it looks like a template file. The template engine probably doesn't parse PHP in the template.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
bali2002
Forum Newbie
Posts: 3
Joined: Wed Jan 27, 2010 2:29 pm

Re: Passing/getting a variable

Post by bali2002 »

Yes! I hadn't noticed that!
It is a .tpl

Any solution?

Thanks
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Passing/getting a variable

Post by AbraCadaver »

bali2002 wrote:Yes! I hadn't noticed that!
It is a .tpl

Any solution?

Thanks
This is not PHP, this is a secondary system (template engine, framework, something else). Wherever you set template vars you would set a var kw = $_GET['kw'] and then use {$kw}, or you could try:

Code: Select all

<a href="{$article.link}?tid={$_GET.kw}">
That is just a wild guess as I have no idea what this system is or is doing.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply