markvaughn2006 Posted September 27, 2009 Share Posted September 27, 2009 Is there a way to echo a variable in a way that it can also be a link?? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/175674-solved-echo-a-variable-as-an-html-link/ Share on other sites More sharing options...
Alex Posted September 27, 2009 Share Posted September 27, 2009 Not being very clear.. $var = "<a href='http://phpfreaks.com'>PHP Freaks!</a>"; echo $var; Quote Link to comment https://forums.phpfreaks.com/topic/175674-solved-echo-a-variable-as-an-html-link/#findComment-925711 Share on other sites More sharing options...
mikesta707 Posted September 27, 2009 Share Posted September 27, 2009 echo "<a href='$variable'>$variable</a>"; //or if variable isnt the link echo "<a href='whatever links'>$variable</a>"; Quote Link to comment https://forums.phpfreaks.com/topic/175674-solved-echo-a-variable-as-an-html-link/#findComment-925712 Share on other sites More sharing options...
markvaughn2006 Posted September 27, 2009 Author Share Posted September 27, 2009 Not being very clear.. $var = "<a href='http://phpfreaks.com'>PHP Freaks!</a>"; echo $var; Thats exactly what I was looking for! Thanks Alex Quote Link to comment https://forums.phpfreaks.com/topic/175674-solved-echo-a-variable-as-an-html-link/#findComment-925713 Share on other sites More sharing options...
markvaughn2006 Posted September 27, 2009 Author Share Posted September 27, 2009 would this also work? $var = "<a href='$link'>$title</a>"; echo $var; Quote Link to comment https://forums.phpfreaks.com/topic/175674-solved-echo-a-variable-as-an-html-link/#findComment-925716 Share on other sites More sharing options...
Alex Posted September 27, 2009 Share Posted September 27, 2009 would this also work? $var = "<a href='$link'>$title</a>"; echo $var; Yup. Quote Link to comment https://forums.phpfreaks.com/topic/175674-solved-echo-a-variable-as-an-html-link/#findComment-925718 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.