Quick php link question

Status
Not open for further replies.

wrstroud

New member
Dec 15, 2006
252
2
0
Can someone help me figure out how to write this correctly...I keep getting errors.

Code:
echo <a href="http://mysite.com/"$name>"$name"</a>;

I'm trying to make a link that will just output the $name variable but that name variable will link to mysite.com/name
 


Then theres always...

Code:
 echo "<a href=\"http://mysite.com/".$name."\">".$name."</a>";

Thats the long way around I guess...

Pretty much the \" is just escaping the quotes in front of it so they show in your page source...
 
You can also use php's Heredoc. Anyway, try googling next time there are at least four easy ways to do it :)
 
yea i looked but couldn't find a straight up answer. thanks for the responses though, everything works perfectly now.
 
Status
Not open for further replies.