Carriage Return from textarea not in email
Is there a way for the email to contain the carriage returns used when adding data in a text area rather than returning the data inline?
Is there a way for the email to contain the carriage returns used when adding data in a text area rather than returning the data inline?
you need to know the name of the text area, and use the nl2br() function which converts carriage returns to <br> tags. if the name of the text area is "message", add the following code to line 1 of your page:
<?php
if(isset($_POST['message'] && $_POST['message'] != "") {
$_POST['message'] = nl2br($_POST['message']);
}
?>
Thanks Jason
I get a warning in Dreamweaver that there is a Syntax error in the code that you have supplied
sorry, correct code is:
<?php
if(isset($_POST['message']) && $_POST['message'] != "") {
$_POST['message'] = nl2br($_POST['message']);
}
?>
Ive just tried using this again, but no message is included in the email.
The code created by DW is;
<?php echo ((isset($_POST["message"]))?$_POST["message"]:"")?>
however the code previously doesn't work.
Any ideas?
try changing:
<?php echo ((isset($_POST["message"]))?$_POST["message"]:"")?>
to:
<?php echo ((isset($_POST["message"]))?nl2br($_POST["message"]):"")?>
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.