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 Quote Link to comment 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]); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.