• C

mailing in php?

This is here since there is no php section.

I am using the mail function.  In the "message" section, I entered text, being very careful that it was formatted correctly.  However, once mailed, I end up with line breaks in the text in strange places, apparently random.  Sometimes there will be one word and then a line break in a sentance, sometimes 6 or 7 words and then a break.

Any idea what would might be causing this?


Who is Participating?
EatEmAndSmileConnect With a Mentor Commented:
I've got an important tip for you. Now that you realized html editors cause undesired errors on scripts, I'd suggest you to do something I've been doing for a while. What I do is separate the HTML pages from the PHP3 pages... For example, an upload file form would be an HTML page with a form on it. The form will pass data to a PHP3 page. But this PHP3 page isn't the page shown. Actually it proccess what it must do and then a 'Header ("Location: otherpage.html");' will redirect the browser to the page that should be shown if the upload was succesful or if it was unsuccesful or if a field was blank, or if the file was too big, etc...


Eat`Em And Smile!
Have you tried forcing the breaks in predictable places?

Just to see what will happen.
ChrisAndrewsAuthor Commented:

Yes, by using \n

and by just putting a line break using the 'enter' key in the text.  Is that what you mean?

Both of these worked to cause a line break, but the unwanted line break still appears.

Just to test it, I deleted the space between the words where one unwanted line bread was.  When I did that, the unwanted line break still occurred, just one word over to the left from where it was.  Odd.
ChrisAndrewsAuthor Commented:

Oh, just figured it out.

I edited the php script in a text editor and then pasted it onto a web page in my html editor.  

I think my html editor (HoTMetaL) forced some line breaks in the text.   arrrrgggghhh.

Didn't show up as line breaks when I first pasted it in for some reason, but when I had closed it and then reopened it later the breaks are there, in the same places as the unwanted breaks appear in the email, how 'bout that.

I think I am going to give up on html editors, since I have been using more php and javascript the editors have been causing lots of problems like this.

Thank you for your response though,

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.