Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Junior Member
    Join Date
    Jul 2006
    Posts
    2
    Member #
    13475
    I'm a newbie and maybe this has been answered many times before.
    I have a simple HTML form with a text area of 10 rows, 40 cols. The intention is that a user can enter any text into this box including carriage returns. The form is handled by a bit of php on the server side. The textarea is identified to the php code as $comments.
    php code is
    .....
    PHP Code:
    $comments strtok$comments"\r\n") ;
     
    $messageproper =
    "This message was sent from the form on the web site:\n" .
    "by:\n" .
    "$surname\n" .
    "telephone:" .
    "$telephone\n" .
    "$email\n" .
    "The text of the message is :\n" .
    "$comments\n" ;
    mail($mailto$subject$messageproper"From: \"$surname\" <$mailto>\r\nReply-To: \"$surname\" <$mailto>\r\nX-Mailer: chfeedback.php 2.04" );
    header"Location: $thankyouurl);
    exit ; 
    and simply creates an email to the site owner.
    The problem is that if the user enters a CR in the textarea then the delivered message arrives, terminating at the CR.

    Any help greatly received

    Thanks

  2.  

  3. #2
    Senior Member
    Join Date
    Apr 2006
    Posts
    146
    Member #
    13110
    Liked
    1 times
    k well i have no clue but maybe try using the stripslash function or somthing idk

  4. #3
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    [phpfunction]stripslashes[/phpfunction] has nothing to do with line conversions.

    Try changing each occurence of \n with \r\n. You can use [phpfunction]str_replace[/phpfunction] on $comments as well.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  5. #4
    Junior Member
    Join Date
    Jul 2006
    Posts
    2
    Member #
    13475
    The problem was the strtok function which it seems breaks up strings on the /x delimiter, in this cas /n being a new line. Thanks for your help


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 11:44 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com