Hi
I have a form that writes to a php file, and interprets the textarea page breaks as <br>. It also reads from the php file and displays the content in the textarea upon loading the page. What I need to do is have it so when the text is written, it still converts the textarea line breaks to <br> but when it reads from the text file to display it in the text field it converts them back to textarea line breaks.
Here’s my code
[CODE]
<?php
if ($submit) {
$fp = fopen(“iroster.php”, “w”);
fwrite($fp, stripslashes(nl2br($newdata)));
fclose($fp);
}
$fp = fopen(“iroster.php”, “r”);
while (!feof($fp)) {
$data .= fgets($fp, 4096);
}
fclose($fp);
$newdata = nl2br($newdata)
?>
<html>
<head>
<title>Test</title>
</head>
<body>
<form action=”<? print $PHP_SELF; ?>” method=”post”>
<textarea name=”newdata” rows=”10″ cols=”40″>
<?
print $data;
?>
</textarea>
<input type=”submit” name=”submit” value=”Submit”>
</form>
</body>
</html>
Thanks in advance for any help.