Page 1 of 1

$_get

Posted: Tue Jan 11, 2011 5:52 pm
by dsjoes
can someone tell me how to get the download part of this to work
the $file gets the correct information for the embed part but it dosn't work for anything after that is ther something i need to do to get it to display after

Code: Select all

<?php  
$file = $_GET["listen"];
echo "<embed src=\"../audio/audio_files/$file\" autostart=\"false\" loop=\"false\" height=\"45\" width=\"170\"></embed>";
echo '<br/>';
echo '<a href=/audio/audio_files/$file target="_blank">Download</a> (Right click and save target as)';
?>

Re: $_get

Posted: Tue Jan 11, 2011 6:26 pm
by danwguy
Your link doesn't have the correct sytax from what Ican see. I would use something like this...

Code: Select all

echo "<embed src=\"../audio/audio_files/".$file."\" autostart=\"false\" loop=\"false\" height=\"45\" width=\"170\"></embed>";
echo '<br/>';
echo "<a href=/audio/audio_files/".$file."\" target="_blank">Download</a> (Right click and save target as)";

Could be wrong but I'm pretty sure that is the proper syntax for calling a href with a variable. I've used that exact syntax to show a file using a php script before.

Re: $_get

Posted: Tue Jan 11, 2011 6:42 pm
by dsjoes
i now get this message here
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';'

Code: Select all

echo "<a href=/audio/audio_files/".$file."\" target="_blank">Download</a> (Right click and save target as)";
fixed it thanks

Re: $_get

Posted: Tue Jan 11, 2011 7:06 pm
by danwguy
Sorry I forgot to add one part to that...

Code: Select all

echo "<a href=/audio/audio_files/".$file."\" target='_blank'>Download</a> (Right click and save target as)";
putting single quotes around the _blank in target. Did that work?