Passing PHP Variable in "embed src" (Flash)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
stuaz
Forum Newbie
Posts: 4
Joined: Tue Aug 16, 2011 8:06 am

Passing PHP Variable in "embed src" (Flash)

Post by stuaz »

Hi,

I have the following script:

Code: Select all

						//Set File Path
						$filename = $_POST['month'] . "-" . $_POST['year'] . "-salesappraisal-" . $_POST['branch'] . ".swf";
						echo $filename . ", ";
						//Set Embed Src
						$embedsrc = "/sales_dashboards/salesman_apprasial/" . $filename;
						echo $embedsrc;
							$content = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
							codebase="http://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" 
							WIDTH="1083" HEIGHT="785" id="myMovieName">
							<PARAM NAME="movie" VALUE=$filename> 
							<PARAM NAME="quality" VALUE="high">
							<PARAM NAME="bgcolor" VALUE="#FFFFFF">
							<PARAM NAME="play" VALUE="true">
							<PARAM NAME="loop" VALUE="true">
							<PARAM NAME=bgcolor VALUE="#FFFFFF">
							
							<EMBED src=$embedsrc quality=high bgcolor=#FFFFFF WIDTH="1083" HEIGHT="785"
								
							NAME="myMovieName" ALIGN="" TYPE="application/x-shockwave-flash" 
							play="true" loop="true" 
							PLUGINSPAGE="http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
							</EMBED>
							</OBJECT>';
The problem I have is that I can't get "EMBED Src=" to take the path from a PHP variable ($embedsrc).

I am a bit of a PHP newb so I realise something may be wrong with the syntax etc.....
oscardog
Forum Contributor
Posts: 245
Joined: Thu Oct 23, 2008 4:43 pm

Re: Passing PHP Variable in "embed src" (Flash)

Post by oscardog »

Code: Select all

                                                //Set File Path
                                                $filename = $_POST['month'] . "-" . $_POST['year'] . "-salesappraisal-" . $_POST['branch'] . ".swf";
                                                echo $filename . ", ";
                                                //Set Embed Src
                                                $embedsrc = "/sales_dashboards/salesman_apprasial/" . $filename;
                                                echo $embedsrc;
                                                        $content = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
                                                        codebase="http://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"
                                                        WIDTH="1083" HEIGHT="785" id="myMovieName">
                                                        <PARAM NAME="movie" VALUE=' . $filename . '>
                                                        <PARAM NAME="quality" VALUE="high">
                                                        <PARAM NAME="bgcolor" VALUE="#FFFFFF">
                                                        <PARAM NAME="play" VALUE="true">
                                                        <PARAM NAME="loop" VALUE="true">
                                                        <PARAM NAME=bgcolor VALUE="#FFFFFF">
                                                       
                                                        <EMBED src="' . $embedsrc . '" quality=high bgcolor=#FFFFFF WIDTH="1083" HEIGHT="785"
                                                               
                                                        NAME="myMovieName" ALIGN="" TYPE="application/x-shockwave-flash"
                                                        play="true" loop="true"
                                                        PLUGINSPAGE="http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
                                                        </EMBED>
                                                        </OBJECT>';
There ya go. As a note, HTML tags should always be lowercase. And you need double quotes (") around your parameters on your embed code.
stuaz
Forum Newbie
Posts: 4
Joined: Tue Aug 16, 2011 8:06 am

Re: Passing PHP Variable in "embed src" (Flash)

Post by stuaz »

omg thank you soooo much.

In regards to the HTML Tags - I inhertied this code from someone else and I agree it is messy! :)

Thank you again.
stuaz
Forum Newbie
Posts: 4
Joined: Tue Aug 16, 2011 8:06 am

Re: Passing PHP Variable in "embed src" (Flash)

Post by stuaz »

Can you help explain why the follow code works in Firefox, but the same code in Internet Explorer does not embed the Flash file but the page renders OK (And View source also looks OK).

Code: Select all

	if ($_POST['branch'] == "80" && $_SESSION['SESS_BRANCH'] == "80" || $_SESSION['SESS_BRANCH'] == "all" && $_POST['branch'] == "80"){

						//echo "2011 WORKED!!"."</p>\n";
						//echo '<a href="http://semissvr/10-OCT-salesappraisaldash-home.php">Salemsan';
						//Set File Path
						$filename = $_POST['month'] . "-" . $_POST['year'] . "-salesappraisal-" . $_POST['branch'] . ".swf";
						//echo $filename . ", ";
						//Set Embed Src
						$embedsrc = "/sales_dashboards/salesman_apprasial/" . $filename;
						//echo $embedsrc;
							$content = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
							codebase="http://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" 
							WIDTH="1083" HEIGHT="785" id="myMovieName">
							<PARAM NAME="movie" VALUE= "' . $filename . '"> 
							<PARAM NAME="quality" VALUE="high">
							<PARAM NAME="bgcolor" VALUE="#FFFFFF">
							<PARAM NAME="play" VALUE="true">
							<PARAM NAME="loop" VALUE="true">
							<PARAM NAME=bgcolor VALUE="#FFFFFF">
							
							<EMBED src= "' . $embedsrc . '" quality=high bgcolor=#FFFFFF WIDTH="1083" HEIGHT="785"
								
							NAME="myMovieName" ALIGN="" TYPE="application/x-shockwave-flash" 
							play="true" loop="true" 
							PLUGINSPAGE="http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
							</EMBED>
							</OBJECT>';
							echo $content;								
					
				}
stuaz
Forum Newbie
Posts: 4
Joined: Tue Aug 16, 2011 8:06 am

Re: Passing PHP Variable in "embed src" (Flash)

Post by stuaz »

Problem solved.

IE didn't like the <PARAM NAME="movie" VALUE= "' . $filename . '"> bit to be just the file name, but prefered the direct path to the .swf file. Works now in both IE and FF.
Post Reply