|  | Posted by Shelly on 07/21/05 14:10 
Thanks, I'll try that.
 Shelly
 
 "Ken Robinson" <kenrbnsn@rbnsn.com> wrote in message
 news:1121919616.031532.326200@z14g2000cwz.googlegroups.com...
 >
 >
 > Shelly wrote:
 >> I write to a file with fwrite.  I do it with wordwrap (which I now think
 >> is
 >> unnecessary).  In the text area that it appears, it is left adjusted.
 >> Anyway, the command is:
 >>
 >>     $message = wordwrap($_POST['Message'], 70);
 >>
 >> where Message is the name of the text field.
 >>
 >> Now when I go to read it, I use fread.  The command is:
 >>
 >>   $message = fread($handle, 5000);
 >>
 >> and I put in the text area of the read form:
 >>
 >>     <textarea name="Message" cols="70" rows="15" readonly="readonly">
 >>   <?php echo wordwrap($message, 70); ?></textarea>
 >>
 >> Here is the problem.  There are about 15 spaces or so before the first
 >> bit
 >> of text.  After that, everything is fine.  It wordwraps fine and does new
 >> paragraphs.  I cannot seem to find where those initial spaces entered the
 >> picture.
 >
 > You're correct, you don't have to use wordwrap() before writing the
 > text to a file. You also don't have to use it when displaying the
 > message in the textarea. It will be automagically wrapped at the
 > correct places.
 >
 > Please dump the incoming text at the start of your program, by adding
 > the following code:
 >
 > echo '<pre>';print_r($_POST['Message']);echo '</pre>';
 >
 > and see if the incoming text is correct.
 >
 > If you still can't figure out where the extra spaces are coming from,
 > you can do use the ltrim() function to remove those spaces when
 > displaying the text.
 >
 >     <textarea name="Message" cols="70" rows="15" readonly="readonly">
 >     <?php echo ltrim($message); ?></textarea>
 >
 > Ken
 >
  Navigation: [Reply to this message] |