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
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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.