Hi, Novice to php, so here goes: need to vary a handful of flash banners by a passed in variable, and I am using a Switch statement - here's the code switch ($j) { case 10: echo "value of $ j = 0 <br> "; break; case 11: echo "value of $ j = 1 <br> "; break; case 12: echo "value of $ j = 2 <br> "; break; case 13: echo "value of $ j = 3 <br> "; break; case 8: print '<script type="text/javascript"> AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','480','height','80','src','../pages/shopbanner','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','../pages/shopbanner' ); //end AC code </script><noscript><object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="480" height="80"> <param name="movie" value="../pages/shopbanner.swf" /> <param name="quality" value="high" /> <embed src="../pages/shopbanner.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="480" height="80"></embed> </object></noscript>'; break; default: echo "value of $ j = Default value <br> "; break; } any idea why the page bombs when it hits the script condition? It is probably something stupid, and maybe there is a better way to conditionally include the code? Thanks in advance!
Try escaping the single quotes within the print with a '. You have nested single quotes which is causing your error. Within the print put a \ before each '. ie: AC_FL_RunContent( \'codebase\' ......... etc
Change the "case 8" section to: case 8: print <<<EOD <script type="text/javascript"> AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','480','height','80','src','../pages/shopbanner','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','../pages/shopbanner' ); //end AC code </script><noscript><object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="480" height="80"> <param name="movie" value="../pages/shopbanner.swf" /> <param name="quality" value="high" /> <embed src="../pages/shopbanner.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="480" height="80"></embed> </object></noscript> EOD; break; Code (markup):