marklarah Posted June 23, 2008 Share Posted June 23, 2008 Okay. Im making a simple web editor. Code so far. <? function read($name){ $size = filesize($name); if ($size != 0){ $F = fopen($name,"r"); $data = fread($F, $size); fclose($F); if ($data != ""){ print $data; }else{ print ""; } }else{ print ""; } } function write($name, $content){ $W = fopen($name, 'w'); fwrite($W, $content); fclose($W); } if (isset($_POST['cont'])){ $cont = nl2br($_POST['cont']); write("test2.php", $cont); echo '<p align="center">Saved!</p><br>'; } echo '<center>'; echo '<form action="" method="POST">'; echo '<textarea cols="125" rows="40" name="cont">'; read("test2.php"); echo '</textarea><br>'; echo '<input type="submit" value="Save"></form>'; echo '</center>'; ?> Nothing particularly wrong. (was using nl2br) The only thing is, I see in the textarea, <br> etc. How can I make it so when there are linebreaks they show up normally and such? http://awesomealpha.com/test4.php You can see it here. Link to comment https://forums.phpfreaks.com/topic/111417-solved-fread-and-fwrite-etc/ Share on other sites More sharing options...
marklarah Posted June 23, 2008 Author Share Posted June 23, 2008 Okay line breaks fixed, but problem with the "/"'s Link to comment https://forums.phpfreaks.com/topic/111417-solved-fread-and-fwrite-etc/#findComment-571887 Share on other sites More sharing options...
DarkWater Posted June 23, 2008 Share Posted June 23, 2008 stripslashes(). But why do you have like, 187297648 slashes in there? Link to comment https://forums.phpfreaks.com/topic/111417-solved-fread-and-fwrite-etc/#findComment-571889 Share on other sites More sharing options...
marklarah Posted June 23, 2008 Author Share Posted June 23, 2008 I was hoping you could tell me. and striplashes was what i was looking for thanks. Link to comment https://forums.phpfreaks.com/topic/111417-solved-fread-and-fwrite-etc/#findComment-571892 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.