note 89715 deleted from function.mail by danbrown

From: Date: Fri, 20 Mar 2009 12:58:17 +0000
Subject: note 89715 deleted from function.mail by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-152205@lists.php.net to get a copy of this message
Note Submitter: Amaroq ---- If you're using mail() to process user-submitted forms that have an imposed character limit, you must remember that php treats "\r\n" as two characters, while javascript treats it as one. <?php $accurately_trimmed_str = substr(str_replace("\r\n", "\n", $initial_str), $start, $imposed_length); ?> This is important if you have a javascript counter tracking how many characters the user has left. Using the above example, your php will trim multi-lined messages to the exact same length javascript validated them as. If I had thought of this starting out, I would have saved myself several hours of trouble trying to get php to cut a message to the same length that my auxiliary javascript validation imposed on it.

« previous php.notes (#152205) next »