smordue Posted December 30, 2009 Share Posted December 30, 2009 I am using this code to pull from a flatfile: <? $lines = file('basedata.txt'); $l5n = ( $lines[36] ); $l5 = ( $lines[37] ); $lines[36] = preg_replace("#[\r\n]+$#", '', $lines[36]); $lines[37] = preg_replace("#[\r\n]+$#", '', $lines[37]); if(!empty($lines[36])) { echo "<li><a href='$l5'>$l5n</a></li>"; } ?> Occasionally a user will enter a name in line 36 with an apostrophe and when I pull it with the above I get "Bill\'s Bar". Where would I put "stripslashes" in the above for line 36 only, or can it be added to the preg_replace statement? Line 37 is a url so I don't want that messed with? Thanks for your help! Steve Link to comment https://forums.phpfreaks.com/topic/186704-where-to-stripslashes/ Share on other sites More sharing options...
mattal999 Posted December 30, 2009 Share Posted December 30, 2009 $l5n = stripslashes($lines[36]); $l5 = stripslashes($lines[37]); Link to comment https://forums.phpfreaks.com/topic/186704-where-to-stripslashes/#findComment-986002 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.