Jump to content

Where to stripslashes


smordue

Recommended Posts

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

Archived

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

×
×
  • Create New...

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.