Jump to content

Passing variables


the15mw

Recommended Posts

I'm a newbie here and to php and Javascript.  So hello all.

 

I am trying to get a portion of a file name passed from one file (first.php) which displays a MySql table.  One of the fields is a link that is supposed to open a popup window (second.php) and begin playing a mp3 file with the flash media player.

 

I have everything (almost) working.  The table displays as it should, the link is fine.  However, I can not get the popup to open with the dimensions I asked for.  It opens in a full size new window.  And the mp3 will not play.  I get the message from the player "we are unable to connect...etc  etc".  The file name shows up in the status bar and in the URL window.

 

In the file first.php, the table displays, the links appear to be active.  when clicked the new window opens, the file names carry over but I can not get the file to play.  The player loads (in file second.php) but I get the message from the player "we are unable to connect...etc  etc".

 

I suspect it is in the syntax.  I have tried so many combinations I can't list them here and so far I have been unable to find anything on google, etc to answer this.  After almost three days I have resorted to here.  This may not even be the right place for me.  Javascript may be my best bet for all I know.

 

Can someone please look over what I have and at least point me in the right direction?

Any help is greatly appreciated as this is my first attempt at a website.

Thanks

 

 

first.php

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">


<html>
<head>

<script language="JavaScript">
<!-- Begin
function popUp(URL) {

playwindow=window.open(URL, 'name', 'toolbar=0,scrollbars=1,location=1,statusbar=1,menubar=0,resizable=1,width=350,height=250');
}
// End -->
</script>

<script language="JavaScript">
<!--
function openPlayer(URL) {
player = window.open('player10.php?','width=350,height=275')
}
// End -->
</script>



<?php
$username="myusername";
$password="mypassword";
$database="mydb";


mysql_connect('mydb',$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM mytable";
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();
?>


</head>
<body>
<table border="1" cellspacing="2" cellpadding="2">
<tr>
<th><font face="Arial, Helvetica, sans-serif">Listen</font></th>
<th><font face="Arial, Helvetica, sans-serif">f2</font></th>
<th><font face="Arial, Helvetica, sans-serif">f3</font></th>
<th><font face="Arial, Helvetica, sans-serif">f4</font></th>
<th><font face="Arial, Helvetica, sans-serif">f5</font></th>
<th><font face="Arial, Helvetica, sans-serif">f6</font></th>
</tr>

<?php
$i=0;
while ($i < $num) {

$f1=mysql_result($result,$i,"listen");
$f2=mysql_result($result,$i,"field2");
$f3=mysql_result($result,$i,"field3");
$f4=mysql_result($result,$i,"field4");
$f5=mysql_result($result,$i,"field5");
$f6=mysql_result($result,$i,"field6");
?>

<tr>
<td><font face="Arial, Helvetica, sans-serif"><a href="javascript:openPlayer('player10.php?<?php echo $f1?>')">Listen</a></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f2; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f3; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f4; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f5; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f6; ?></font></td>
</tr>

<?php
$i++;
}
?>
</body>
</html>

 

 

 

SECOND.PHP

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">

     
<head>         
  <meta http-equiv="Content-Type" content="text/html; 	charset=UTF-8" >    
  <meta http-equiv="X-UA-Compatible" content="IE=8" >         
  <title>My Title              
  </title>             
  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" >         
      

<script language="JavaScript" type="text/javascript"> 
<!--
    //
    // Make sure there's some data
    //
if (location.search) {
        //
        // Extract the name of the graphics file
        //
    var mp3_filename = location.search.substring(1)
        //
        // Write the &ltIMG> tag using the name of the graphics 
        // file (you may need to adjust the SRC text)
        //
document.write('<a href="http://mywebsite.com/+mp3_filename">') 
    }
//   End  --> 
</script> 



</head>                  
<body>
  
<object width="400" height="300"> 
  <param name="movie" value="http://fpdownload.adobe.com/strobe/FlashMediaPlayback.swf">
  </param>
  <param name="flashvars" value="src=http%3A%2F%2Fmywebsite.com%2Faudio%2F+mp3_filename">
  </param>
  
  
  <param name="allowFullScreen" value="true">
  </param>
  <param name="allowscriptaccess" value="always">
  </param>
  <embed src="http://fpdownload.adobe.com/strobe/FlashMediaPlayback.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="400" height="300" flashvars="src=http%3A%2F%2Fmywebsite.com%2Faudio%2F+mp3_filename">
  </embed>
</object>

</body>
</html>

 

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.