Apostrophe Pains

I have a form that collects comments. When the user submits the form the data is sent to a page that handles the data and converts it into a string and saves it to a .csv file. When a user types a word that contains an apostrophe in the the form though I have an extra \ before the apostrophe in my .csv file. How do I prevent this extra character from ending up in my csv file. Any help is much appreciated.

THis is the code I am using to handle my form data
[php]

<?php $mm = $_POST['mm']; $dd = $_POST['dd']; $yy = $_POST['yy']; $name = $_POST['name']; $comment = $_POST['comment']; $fp = fopen("datafeed/filetoread.csv", "a"); $savestring = $mm . " " . $dd . " " . $yy . " " . $name . " " . $comment . "\n"; fwrite($fp, $savestring); fclose($fp); echo "

Your data has been saved

"; ?>

[/php]

Change your fwrite to say:
[php]fwrite($fp, stripslashes($savestring));[/php]

Thank You!

Sponsor our Newsletter | Privacy Policy | Terms of Service