Looking to Build/Redesign a Website or Blog ?

To speak to Rakshit, call +91 968 704 2303

[PHP] Stripslashes and fwrite not working

Hello Friends,

I was working with one project and writing textarea’s data into one file using fwrite function of PHP. It keeps adding forward slash whenever single quote comes in string. I have tried to use stripslashes but it did not work. I tried stripslashes twice but it did not work as well. I have tried to turn off magic quotes and it works. Look at below code i was trying and i keep getting forward slash when single quote comes in string.

 
<?php
if($_POST) {
$data = $_POST['data'];
$f = fopen( "text.php", "w" );
fwrite(stripslashes( $f, $data ));
fclose( $f );
}
?>

I have turn off the magic quotes and it works fine.

Share:

No Comments Yet.

Leave a Reply

Your email address will not be published.