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 Quote Link to comment 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>"; Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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.