Forum Moderators: coopster

Message Too Old, No Replies

Variable in link

         

Mnkras

8:13 pm on Oct 22, 2008 (gmt 0)

10+ Year Member



Hi i have a small problem

i have a config.php

with the line

 $mmorpg = "1234"; /* mmorpg toplist vote # */ 

the 1234 is an example

and in vote.php i have the


<?php
include ("config.php")
?>

and for the link i am using ( it has an image)

<a href="http://www.example.com/in.php?site=" . $mmorpg . " title="Vote for us!" target="_blank"> <img src="http://localhost/images/Mmorg200.jpg" border="0" alt="Vote for us!"></a>

after the site= i want to put he variable $mmorpg

i have tried many things and i either get an error or just

http://www.example.com/in.php?site=

without the variable

please help!

This is for a CMS so i want everthing in 1 config file

[edited by: Mnkras at 8:14 pm (utc) on Oct. 22, 2008]

[edited by: eelixduppy at 8:18 pm (utc) on Oct. 22, 2008]
[edit reason] exemplified [/edit]

mooger35

9:38 pm on Oct 22, 2008 (gmt 0)

10+ Year Member



I can't tell if you've opened the php tag yet or not.

If it hasn't been opened try this:

<a href="http://www.example.com/in.php?site=<?php echo $mmorpg ;?>" title="Vote for us!" target="_blank"> <img src="http://localhost/images/Mmorg200.jpg" border="0" alt="Vote for us!"></a>

if it has been opened but you just failed to show it:

echo '<a href="http://www.example.com/in.php?site=' . $mmorpg . '" title="Vote for us!" target="_blank"> <img src="http://localhost/images/Mmorg200.jpg" border="0" alt="Vote for us!"></a>';

Mnkras

9:47 pm on Oct 22, 2008 (gmt 0)

10+ Year Member



thankyou so much!

the problem was that i had closed the tags after the config.php

mooger35

10:10 pm on Oct 22, 2008 (gmt 0)

10+ Year Member



you're welcome.