How do I stripslashes from text?
Posted: Sun Jan 25, 2009 5:20 pm
Hello, new to php and when I have php write to a text file it adds a slash to the text whenever I use ' or ". How can I use stripslashes to my code? I tried a few things and messed it up really good so here is the original code:
Code: Select all
<?php
$t1 = $_POST['loadtext1'];
$t2 = $_POST['loadtext2'];
$t3 = $_POST['loadtext3'];
$t4 = $_POST['loadtext4'];
$t5 = $_POST['loadtext5'];
$t6 = $_POST['loadtext6'];
$t7 = $_POST['loadtext7'];
$toSave = "loadtext1=".$t1."&loadtext2=".$t2."&loadtext3=".$t3."&loadtext4=".$t4."&loadtext5=".$t5."&loadtext6=".$t6."&loadtext7=".$t7;
$fp = fopen("underground/text/text.txt", "w");
if(fwrite($fp, $toSave)) echo "writing=Ok";
else echo "writing=Error";
fclose($fp);
?>