1 Replies - 1097 Views - Last Post: 06 April 2008 - 07:50 AM Rate Topic: -----

#1 douffle   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 29-March 08

Formatting data sent by Form

Post icon  Posted 31 March 2008 - 03:04 PM

Hi,

I am trying to figure out how to format the data sent by a form.

My form is simle and consists of Name: Email: and Message:.

The email data received from the form places the name and the email address on separate lines, one below the other, which is good, but the Message: is displayed all on one big long line. How can I format the Message: part so that it uses carrage returns. The message is a textarea in the form.

The code as it now stands is:

 $headers . "MIME-Version: 1.0\n"
		   . "Content-Transfer-Encoding: 7bit\n"
		   . "Content-type: text/html;  charset = \"iso-8859-1\";\n\n";


// Build the email body text
  $emailcontent = "
-----------------------------------------------------------------------------
   WEBSITE CONTACT ENQUIRY
-----------------------------------------------------------------------------

Name: $name
Email: $email
Message: $message

_______________________________________
End of Email
"; 




Thanks

Is This A Good Question/Topic? 0
  • +

Replies To: Formatting data sent by Form

#2 Gevie   User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 29
  • Joined: 06-April 08

Re: Formatting data sent by Form

Posted 06 April 2008 - 07:50 AM

Hi,
Assuming you're sending this data through email, It would be safe to assume that all \n tags will be formatted as new lines.

When you have a textarea, everytime you press enter, that is registered as \n
Email should have no problem formatting this data to my understanding, although if you're email is using HTML
then try nl2br($message);

I'm sorry if this isn't any help to you.

View Postdouffle, on 31 Mar, 2008 - 03:04 PM, said:

Hi,

I am trying to figure out how to format the data sent by a form.

My form is simle and consists of Name: Email: and Message:.

The email data received from the form places the name and the email address on separate lines, one below the other, which is good, but the Message: is displayed all on one big long line. How can I format the Message: part so that it uses carrage returns. The message is a textarea in the form.

The code as it now stands is:

 $headers . "MIME-Version: 1.0\n"
		   . "Content-Transfer-Encoding: 7bit\n"
		   . "Content-type: text/html;  charset = \"iso-8859-1\";\n\n";


// Build the email body text
  $emailcontent = "
-----------------------------------------------------------------------------
   WEBSITE CONTACT ENQUIRY
-----------------------------------------------------------------------------

Name: $name
Email: $email
Message: $message

_______________________________________
End of Email
"; 




Thanks

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1