Solved

Why this PHP code is not working?

Posted on 2011-02-16
3
216 Views
Last Modified: 2012-05-11
Can anyone tell me why this PHP code is not working?

<?PHP
$play = "filename.mp3";
?>
<embed src="<?php echo $play ?>" id="id_geonews" type="application/x-mplayer2" stretchtofit="true" bgcolor="#000000" url="<?php echo $play ?>" name="geonews" height="64" width="220"></td>


Without PHP code is working:
<embed src="filename.mp3" id="id_geonews" type="application/x-mplayer2" stretchtofit="true" bgcolor="#000000" url="filename.mp3" name="geonews" height="64" width="220"></td>
0
Comment
Question by:shahzad198509
3 Comments
 
LVL 14

Accepted Solution

by:
Dzynit earned 250 total points
ID: 34910120
You're missing the semicolon after $play.
Try this code once:
<embed src="<?php echo $play; ?>" id="id_geonews" type="application/x-mplayer2" stretchtofit="true" bgcolor="#000000" url="<?php echo $play; ?>" name="geonews" height="64" width="220"></td>

Open in new window

0
 
LVL 3

Assisted Solution

by:dtocci
dtocci earned 250 total points
ID: 34910220
Or you can simplify the code like this:
<?PHP
$play = "filename.mp3";
?>
<embed src="<?=$play?>" id="id_geonews" type="application/x-mplayer2" stretchtofit="true" bgcolor="#000000" url="<?=$play?>" name="geonews" height="64" width="220"></td>
0
 

Author Comment

by:shahzad198509
ID: 34910264
Problems is solved. Thanks for help.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question