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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.