|
-
Aug 1st, 2003, 05:14 PM
#1
Thread Starter
Lively Member
POST info into variable removes carrage returns..
I'm playing with an email script thingy. A user has a TEXTAREA and can key in a email to submit.
Example at: http://www.ibarn.net/email
If you key in a message with returns in it, and then submit, the returns are lost.
Index HTML
PHP Code:
<form name="textmsg" method="post" action="http://www.ibarn.net/email/send.php">
<textarea name="message" wrap=virtual cols=38 rows=10></textarea>
</form>
Send PHP
PHP Code:
$message = $_POST['message'];
echo("$message");
Somewhere in these lines the formatting is getting removed. I assume it's something stupid, me not using an argument, or the wrong command (echo instead of something else.. though I've tried PRINT already.)
This is probably really basic, and a real "DUH" cantidate.. but any help would be greatly appreciated.
I'm writing this for the experience, not because I need the program. If I needed it, I could simply go download any of a thousand other existing ones. I seek learning, not utility.. 
Thank you.
"It's difficult to imagine a world in which people voluntarily choose to listen to liberals. There is no evidence that it has ever happened. " - Ann Coulter
-
Aug 1st, 2003, 09:38 PM
#2
Thread Starter
Lively Member
Just to clarify,
The actual email send DOES have the returns in it. It is merely the ECHO or PRINT that's losing the returns. The $message variable *does* include the returns, as shown by the email submission.
And FWIW, the email thing is sending now, so if you're bored and trying it out, don't put anything overly silly and stuff.
"It's difficult to imagine a world in which people voluntarily choose to listen to liberals. There is no evidence that it has ever happened. " - Ann Coulter
-
Aug 2nd, 2003, 01:57 AM
#3
Stuck in the 80s
Newlines will not show up in a webpage. You need to replace them with <br /> using the function nl2br():
Code:
$message = $_POST['message']; //wah? This is redundant
echo(nl2br($message));
//even better:
echo nl2br($_POST['message']);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|