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 Quote 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 Quote 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. Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.