Mike088 Posted October 14, 2008 Share Posted October 14, 2008 Hey all, I am having trouble with printing a hyperlink which includes insertion of variables to complete the link. This is what I got... which is most likely wrong lol: <?php print ("<a href=\"http://mysite.com/place/"$page"/blahblah"$text">Click Me</a>"); ?> I'm getting "Parse error: syntax error, unexpected T_PRINT" Help appreciated Link to comment https://forums.phpfreaks.com/topic/128314-solved-printing-a-hyperlink-including-variables/ Share on other sites More sharing options...
genericnumber1 Posted October 14, 2008 Share Posted October 14, 2008 either remove the extra quotes or add concatenation operators no half-way print ("<a href=\"http://mysite.com/place/$page/blahblah$text>Click Me</a>"); or print ("<a href=\"http://mysite.com/place/".$page."/blahblah".$text.">Click Me</a>"); Link to comment https://forums.phpfreaks.com/topic/128314-solved-printing-a-hyperlink-including-variables/#findComment-664709 Share on other sites More sharing options...
CroNiX Posted October 14, 2008 Share Posted October 14, 2008 either remove the extra quotes or add concatenation operators no half-way print ("<a href=\"http://mysite.com/place/$page/blahblah$text>Click Me</a>"); or print ("<a href=\"http://mysite.com/place/".$page."/blahblah".$text.">Click Me</a>"); you left off the ending escaped quote: print ("<a href=\"http://mysite.com/place/".$page."/blahblah".$text."\">Click Me</a>"); Link to comment https://forums.phpfreaks.com/topic/128314-solved-printing-a-hyperlink-including-variables/#findComment-664713 Share on other sites More sharing options...
Mike088 Posted October 14, 2008 Author Share Posted October 14, 2008 Thanks for your replies got it working cheers Link to comment https://forums.phpfreaks.com/topic/128314-solved-printing-a-hyperlink-including-variables/#findComment-664716 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.