Morris2 Posted November 5, 2011 Share Posted November 5, 2011 Hi. How do I turn a variable into a hyperlink? Here is what I want to do. What is the correct notation? <?php $q=20; echo '<a href="www.phpfreaks.com">$q</a>'; ?> Best regards Morris Link to comment https://forums.phpfreaks.com/topic/250489-how-do-i-turn-a-variable-into-a-hyperlink/ Share on other sites More sharing options...
trq Posted November 5, 2011 Share Posted November 5, 2011 echo "<a href=\"http://www.phpfreaks.com\">$q</a>"; Link to comment https://forums.phpfreaks.com/topic/250489-how-do-i-turn-a-variable-into-a-hyperlink/#findComment-1285164 Share on other sites More sharing options...
Morris2 Posted November 5, 2011 Author Share Posted November 5, 2011 Thanks for this. OK, I have tried this in different ways, within php tags, within html tags, surrounded by ' ' or double " ". I can't make it work. In fact when trying to insert this line in my code document and save it (Joomla - Chronoforms - custom mode, the line is changed. In the example, I want the number 20 to be an interactive link. In fact I am trying to make a whole list of weblinks from a while loop interactive, and wanted to figure that out myself later. First I need to know, how to make the content of a variable an interactive hyperlink ... Best regards Morris Link to comment https://forums.phpfreaks.com/topic/250489-how-do-i-turn-a-variable-into-a-hyperlink/#findComment-1285248 Share on other sites More sharing options...
trq Posted November 6, 2011 Share Posted November 6, 2011 I just showed you how to make a variable a link. Define "can't make it work", the example I posted works as expected. Post your code if you are having trouble. Link to comment https://forums.phpfreaks.com/topic/250489-how-do-i-turn-a-variable-into-a-hyperlink/#findComment-1285368 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.