echo in HTML link

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
j2dao2dae
Forum Newbie
Posts: 1
Joined: Thu Sep 30, 2010 5:15 pm

echo in HTML link

Post by j2dao2dae »

Hi,

Hoping this is posted in the right place. I'm getting a bit stuck . . . I want to display a PHP echo in a HTML link, for example:

http://www.test.co.uk/$name

I want the $name to display as echo. I'm currently using:

<a href="http://www.test.co.uk/<?php echo $name['name']; ?>" target='_blank' >Click Me</a>
This along with the request code kind of works but only displays / links the first letter and not the full echo.

Can someone please advise the best way to echo in a HTML link?

Hope this makes sense and thank you for your time.
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: echo in HTML link

Post by twinedev »

Based on that you are getting only the first letter, I would guess that $name is not actually an array, but a string, so probably just do echo $name;

-Greg
Post Reply