Hi Bob,
Thanks for that. I tried a number of different combinations of the code and the only one that does not give an error is
[pre]// New data maintain line breaks
$form->data['message'] = nl2br($form->data['message']);
[br]echo "Thanks, that was great!<br>";[/pre]
I included an echo to show on the Thank You message that the code had been read and executed.
In the email message I use:
we have received the following message from the website:
<br><br>
{date:d-m-Y H:i}<br>
NAME: {data:name}<br>
EMAIL: {data:email}<br>
<br>
MESSAGE: {data:message}<br><br>
And that all seems to work, except that in the test I enter the following into the message box
Line test number 1[br]Line test number 2[br]Line test number 3[br]Line test number 4
but what I receive is:
MESSAGE: Line test number 1 Line test number 2 Line test number 3 Line test number 4
So thinking that what I was getting back was the original message box text, I changed the PHP so that what was sent to the form was the result of the conversion in a new variable called message_new
$form->data['message_new'] = nl2br($form->data['message']);
and the email message to
MESSAGE: {data:message_new}<br><br>
Sadly now there is nothing in the received email message area. Tried again with
$form->data['message'] = nl2br($form->data['message_new']);
just in case I had the result and the original the wrong way round but that was also blank.
As a test, I tried echoing the content of the message onto the thanks display
echo "Message Content: " . $message . "<br>";
And no matter which I used, it does not show anything for that variable, so it's obviously not transferring the original form message into the PHP. Is there something wrong with how the form data field 'message' is being read by the PHP?
Using
$_POST['message'] = nl2br($form->data['message_new']);
grabs the content of the variable "Message" but it does not pass the content to message_new.
I'm stumped now.