eddy556 Posted August 15, 2007 Share Posted August 15, 2007 Hi, I'm writing a PHP application which deals with mp3 files and uses a bit of javascript. However I cannot get PHP to output this following line correctly without errors: <a href="embed.php?mp3=<?php echo $filename ?>" onClick="return popup(this, 'notes')"><img src="stream.gif" alt="Stream this song" width="14" height="14" border="0"></a> At the moment I close PHP ?> put this line in and open PHP again <?PHP Please can you post a PHP line to output the above? Thanks :-) Quote Link to comment Share on other sites More sharing options...
pranav_kavi Posted August 15, 2007 Share Posted August 15, 2007 what is the error ur getting?? Quote Link to comment Share on other sites More sharing options...
eddy556 Posted August 15, 2007 Author Share Posted August 15, 2007 Expected ; or , somewhere in the line Quote Link to comment Share on other sites More sharing options...
MadTechie Posted August 15, 2007 Share Posted August 15, 2007 try echo "<a href='embed.php?mp3='$filename' onClick='return popup(this, \"notes\")'><img src='stream.gif' alt='Stream this song' width='14' height='14' border='0'></a>"; Quote Link to comment Share on other sites More sharing options...
eddy556 Posted August 15, 2007 Author Share Posted August 15, 2007 Okay that gets rid of the errors however '$filename' is not returning and is being left blank so I end up with an URL like embed.php?mp3= for the link Quote Link to comment Share on other sites More sharing options...
Orio Posted August 15, 2007 Share Posted August 15, 2007 That's probably because $filename is not being defined or not being defined well. Some more code would help in this case. Orio. Quote Link to comment Share on other sites More sharing options...
eddy556 Posted August 15, 2007 Author Share Posted August 15, 2007 OKay wel when I had the code: <a href="embed.php?mp3=<?php echo $filename ?>" onClick="return popup(this, 'notes')"><img src="stream.gif" alt="Stream this song" width="14" height="14" border="0"> $filename works and I also call it from other places and that works fine so I can deduce that $filename works correctly and is populated with the right data. What other code are you wanting? The whole script is 71 lines. Should I post the lot? Quote Link to comment Share on other sites More sharing options...
chocopi Posted August 15, 2007 Share Posted August 15, 2007 try adding the ; after filename <a href="embed.php?mp3=<?php echo $filename; ?>" onClick="return popup(this, 'notes')"><img src="stream.gif" alt="Stream this song" width="14" height="14" border="0"> Hope that helps ~ Chocopi Quote Link to comment Share on other sites More sharing options...
eddy556 Posted August 15, 2007 Author Share Posted August 15, 2007 Thank you that would help if I wanted the link to appear in HTML but I am wanting PHP to reproduce that. Thanks for pointing it out though I never noticed that Quote Link to comment Share on other sites More sharing options...
eddy556 Posted August 15, 2007 Author Share Posted August 15, 2007 Just solved it...I'm dumb lol echo "<a href='embed.php?mp3='$filename' onClick='return popup(this, \"notes\")'><img src='stream.gif' alt='Stream this song' width='14' height='14' border='0'></a>"; I had an extra ' just before $filename when I needed to remove this as I had already opened a ' just before embed.php Quote Link to comment Share on other sites More sharing options...
MadTechie Posted August 15, 2007 Share Posted August 15, 2007 heehee 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.