Jump to content

Combining Javascript and PHP


mediasreamer

Recommended Posts

Hi,

 

I'm trying to launch a flash video from an iframe to play in a video player on another layer. In HTML it works, but I'm a little confused on how to incorporate a database call and javascript into the same line.

 

Here's the HTML version that works:

 

<a href="javascript:createplayer('/video/test.flv')">Test Video</a>

 

Here's the PHP I'm trying to fit this into:

...

echo "<tr>";

$filename = explode("/",$rfiles['vidlink']);

echo "<td bgcolor=".$rowcolor." style=\"padding-left:5px\" class='normal'><a href=javascript:createplayer(/'".$rfiles['vidlink']."') >".$rfiles['vidname']."</a></td></tr>";

 

The code does retrieve the vidlink/vidname file just fine. The problem is it won't launch in the video player on another layer. Any help would greatly be appreciated! Thanks. Jeff

Link to comment
https://forums.phpfreaks.com/topic/130369-combining-javascript-and-php/
Share on other sites

echo "<td bgcolor=".$rowcolor." style=\"padding-left:5px\" class='normal'><a href=javascript:createplayer(/'".$rfiles['vidlink']."') >".$rfiles['vidname']."</a></td></tr>";

 

looks like you have you apostophies messed up in "...createplayer(/'".$ ..... " switch it to "...createplayer('/".$ ...."

ie:

echo "<td bgcolor=".$rowcolor." style=\"padding-left:5px\" class='normal'><a href=javascript:createplayer('/".$rfiles['vidlink']."') >".$rfiles['vidname']."</a></td></tr>";

 

I hope this is fixes it .. a good check when something like this happens is to view the source to make sure the echo'd php is matching up you JS / HTML code

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.