I have media_main.php that is obtaining data from a MySQL database. One of the pieces of data obtained is “filename” using the mySQL SELECT statement. On media_main.php, there is a link to open player.php which has a flash MP3 player embedded. The link to open the new window is as follows:
<a href="javascript:;" onclick="return popitup('player.php')" title="Listen">
I would like “filename” to be passed from media_main.php to the player.php page. I think I need to use GET or POST, but am not sure how to since the data isn’t coming directly from a form.
You can achieve this by reading
$_GET['file']on player.php, and setting it on media_main.php.On
media_main.phpyou would use PHP to make the link dynamic:Which would result in:
Then on player.php, you would echo
$_GET['file']where you want the file to be included.Also, be sure to validate all data. To make it safe to display on your website, you can wrap
$_GET['file']with htmlentities(), so that a user can’t use the$_GET['file']to display HTML on your site.