Jump to content

PHP to Javascript Var


vonKristoff

Recommended Posts

Hiya .. I just want to feed in a variable to my javascript on my HTML page, via PHP because it is grabbing data from the server ...

 

I have a php function that gets called in my header that does something like this:

echo 'flashvars.myvar = "'.$src.'";';

basically I am passing a var to swfObject like so: (see the php call)

<script type="text/javascript">
    var params = {};
    params.menu = "false";
    params.scale = "noscale"
    params.wmode = "transparent";
  	params.allowfullscreen = "true";
  	var flashvars = {};
  	<?php 
  		getHTMLVar();
  	?>
    swfobject.embedSWF("flash/video.swf", "index", "100%", "100%", "9.0.0","expressInstall.swf",flashvars,params);
    </script>

to all u freaks - u already know that this doesnt work, and the page breaks - why is this - and is there another solution?

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/248481-php-to-javascript-var/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.