chrisuk Posted March 4, 2007 Share Posted March 4, 2007 I am trying to create a URL from a record in a database IF there is an entry in the filename field(otherwise i wish for it to say "no file submitted") I have tried both: $url = '<a href="http://<site>/uploads/"'echo $filename'>Link</a>'; and $url = '<a href="http://<site>/uploads/'echo $filename;'">Link</a>'; but both give: Parse error: parse error, unexpected T_ECHO in <site/page.php> on line 33 What am I doing wrong? Thanks Link to comment https://forums.phpfreaks.com/topic/41107-solved-combining-php-variable-with-html-url/ Share on other sites More sharing options...
flappy_warbucks Posted March 4, 2007 Share Posted March 4, 2007 you are putting the varables in a litral string $url = "<a href=\"<site>/uploads/$filename\">Link</a>"; that should work Link to comment https://forums.phpfreaks.com/topic/41107-solved-combining-php-variable-with-html-url/#findComment-199110 Share on other sites More sharing options...
Orio Posted March 4, 2007 Share Posted March 4, 2007 It should be done this way: $url = '<a href="http://<site>/uploads/'.$filename.'>Link</a>'; Orio. Link to comment https://forums.phpfreaks.com/topic/41107-solved-combining-php-variable-with-html-url/#findComment-199111 Share on other sites More sharing options...
chrisuk Posted March 4, 2007 Author Share Posted March 4, 2007 thanks guys, I knew I was doing something daft. Much to learn eh! Appreciated Link to comment https://forums.phpfreaks.com/topic/41107-solved-combining-php-variable-with-html-url/#findComment-199115 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.