Jump to content


Print and apostrophe problem

  • Please log in to reply
1 reply to this topic

#1 davehardyuk

  • New Members
  • Pip
  • Newbie
  • 7 posts
  • LocationPlymouth, UK

Posted 10 March 2006 - 02:21 PM

Hi guys, i have this code:

print "
<body marginheight=\"0\" marginwidth=\"0\" leftmargin=\"0\" rightmargin=\"0\">
<object id=\"MediaPlayer\" width=\"360\" height=\"69\" classid=\"CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95\" type=\"application/x-oleobject\">
<param name=\"FileName\" Value=\"$fileid\">
<param name=\"ShowControls\" value=\"true\"><param name=\"ShowStatusBar\" value=\"true\">
<param name=\"ShowStatusBar\" value=\"true\"><param name=\"ShowDisplay\" value=\"false\">
<param name=\"autostart\" value=\"true\">
<EMBED SRC=\"$fileid\" WIDTH=\"360\" HEIGHT=\"69\" AUTOSTART=\"FALSE\" TYPE=\"audio/mpeg\"></EMBED> 

Which pulls in a variable called $fileid.

The problem is, sometimes the fileid has an apostrophe in the filename and it can't be played.

Any ideas on how to get around it?



#2 craygo

  • Staff Alumni
  • Advanced Member
  • 1,973 posts
  • LocationRhode Island

Posted 10 March 2006 - 02:32 PM

Use the addslashes function. you can call it before

$fileid2 = addslashes($fileid);

then use $fileid2 in the echo

<param name=\"FileName\" Value=\"$fileid2\">

you can also callit right in the echo but this seems easier


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users