Revision: 31569
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 9, 2010 01:55 by adampatterson
Initial Code
<?
// Get the message String
$rawString = $_POST['comments'];
// Split the string into pieces for processing
$pieces = explode("\n", $rawString);
// First element is the subject line
$subject = $pieces[0];
// Take the array, delete the first entry, So we can pass it to $message
$messagePieces = array_slice($pieces, 1);
// Replace the \n or add a <br /> if you like.
$message = implode("<br />", $messagePieces);
echo "Subject: ". $subject;
echo "<br />";
echo "Message: ". $message;
?>
<form action="<? echo $_SERVER['php_self'] ?>" method="post">
<textarea id="comments" name="comments">Your message</textarea>
<input name="send" type="submit" value="Send" />
</form>
Initial URL
http://www.adampatterson.ca/blog/2010/09/php-handy-little-snippet-for-multiline-text-box/
Initial Description
Initial Title
PHP: Handy little Snippet for Multiline Text Box
Initial Tags
php, array
Initial Language
PHP