adam291086 Posted December 12, 2007 Share Posted December 12, 2007 I am trying to put variables in my a href. The www.adamplowman.co.uk is echoed but the variable's aren't. Any idea? echo '<a href="http://www.adamplowman.co.uk".$dir.$name>Service delivery team</a>'; Link to comment https://forums.phpfreaks.com/topic/81356-solved-echo-variable-in-a-href/ Share on other sites More sharing options...
cooldude832 Posted December 12, 2007 Share Posted December 12, 2007 I like to use only double quotes, so this is with double quotes <?php echo "<a href=\"http://www.adamplowman.co.uk".$dir.$name."\">Service delivery team</a>"; ?> Link to comment https://forums.phpfreaks.com/topic/81356-solved-echo-variable-in-a-href/#findComment-412871 Share on other sites More sharing options...
beansandsausages Posted December 12, 2007 Share Posted December 12, 2007 Try : echo "<a href=\"http://www.adamplowman.co.uk".$dir."".$name."\">Service delivery team</a>"; think thats right Link to comment https://forums.phpfreaks.com/topic/81356-solved-echo-variable-in-a-href/#findComment-412874 Share on other sites More sharing options...
beansandsausages Posted December 12, 2007 Share Posted December 12, 2007 @cooldude you just got in there b4 me Link to comment https://forums.phpfreaks.com/topic/81356-solved-echo-variable-in-a-href/#findComment-412876 Share on other sites More sharing options...
adam291086 Posted December 12, 2007 Author Share Posted December 12, 2007 it works perfectly cooldude832. Thanks for the help. Yet again phpfreaks save the day. Link to comment https://forums.phpfreaks.com/topic/81356-solved-echo-variable-in-a-href/#findComment-412877 Share on other sites More sharing options...
cooldude832 Posted December 12, 2007 Share Posted December 12, 2007 Question for you, do you use a pretty print editor? If you don't I'd suggest you get one cause it will make your life a ton easier because you can pick up syntaxical errors very quickly. Your version doesn't escape back into a string after $name Link to comment https://forums.phpfreaks.com/topic/81356-solved-echo-variable-in-a-href/#findComment-412881 Share on other sites More sharing options...
adam291086 Posted December 12, 2007 Author Share Posted December 12, 2007 I do use an editor at home. I am at work at the mo supposed to be watching people in a pool. I'd rather be coding for my uni project. Therefore i am having to use notepad Link to comment https://forums.phpfreaks.com/topic/81356-solved-echo-variable-in-a-href/#findComment-412884 Share on other sites More sharing options...
cooldude832 Posted December 12, 2007 Share Posted December 12, 2007 if only I had a pool to sit next to, oh wait it be frozen. Link to comment https://forums.phpfreaks.com/topic/81356-solved-echo-variable-in-a-href/#findComment-412888 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.