Jump to content


This topic is now archived and is closed to further replies.


Print and apostrophe problem

Recommended Posts

Hi guys, i have this code:

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



Share this post

Link to post
Share on other sites
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


Share this post

Link to post
Share on other sites


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.