coutts Posted November 4, 2008 Share Posted November 4, 2008 Hi I have the following code to concatenate a variable (which is later emailed). When it is emailed it is emailed in 2 lines of HTML and this causes problems with the links. Can anyone tell me how to code this so that the HTML it creates is in multiple lines ie the string variable is in multiple lines Thanks Robert $message .="Waterfront & Waterview Properties<br>"; $message .="<a href='http://www.website.com/articles/1.html' target='_blank'>[Read]</a><br><br>"; $message .="Making Money from Real Estate Investments on PEI<br>"; $message .="<a href='http://www.website.com/articles/2.html' target='_blank'>[Read]</a><br><br>"; $message .="Why do people move to PEI?<br>"; $message .="<a href='http://www.website.com/articles/3.html' target='_blank'>[Read]</a><br><br>"; $message .="PEI as a Tourist Destination<br>"; $message .="<a href='http://www.website.com/articles/4.html' target='_blank'>[Read]</a><br><br>"; $message .="The Purchasers Point of View<br>"; $message .="<a href='http://www.website.com/articles/7.html' target='_blank'>[Read]</a><br><br>"; $message .="What to expect when selling your home.<br>"; $message .="<a href='http://www.website.com/articles/8.html' target='_blank'>[Read]</a><br><br>"; $message .="The Days of Posting a Sign on your lawn to sell your home are gone!<br>"; $message .="<a href='http://www.website.com/articles/9.html' target='_blank'>[Read]</a><br><br>"; $message .="Retire to Summerside Prince Edward Island<br>"; $message .="<a href='http://www.website.com/articles/10.html' target='_blank'>[Read]</a><br><br>"; $message .="Acquiring PEI Real Estate as a Non Resident<br>"; $message .="<a href='http://www.website.com/articles/6.html' target='_blank'>[Read]</a><br><br>"; $message .="Properties without Services<br>"; $message .="<a href='http://www.website.com/articles/5.html' target='_blank'>[Read]</a><br><br>"; Link to comment https://forums.phpfreaks.com/topic/131349-solved-concatenating-a-string-variable-within-lines/ Share on other sites More sharing options...
rhodesa Posted November 4, 2008 Share Posted November 4, 2008 you mean you want a new line at the end of each? i don't see how that will make a difference but.... $message .="Waterfront & Waterview Properties<br>\n"; $message .="<a href='http://www.website.com/articles/1.html' target='_blank'>[Read]</a><br><br>\n"; $message .="Making Money from Real Estate Investments on PEI<br>\n"; $message .="<a href='http://www.website.com/articles/2.html' target='_blank'>[Read]</a><br><br>\n"; $message .="Why do people move to PEI?<br>\n"; $message .="<a href='http://www.website.com/articles/3.html' target='_blank'>[Read]</a><br><br>\n"; $message .="PEI as a Tourist Destination<br>\n"; $message .="<a href='http://www.website.com/articles/4.html' target='_blank'>[Read]</a><br><br>\n"; $message .="The Purchasers Point of View<br>\n"; $message .="<a href='http://www.website.com/articles/7.html' target='_blank'>[Read]</a><br><br>\n"; $message .="What to expect when selling your home.<br>\n"; $message .="<a href='http://www.website.com/articles/8.html' target='_blank'>[Read]</a><br><br>\n"; $message .="The Days of Posting a Sign on your lawn to sell your home are gone!<br>\n"; $message .="<a href='http://www.website.com/articles/9.html' target='_blank'>[Read]</a><br><br>\n"; $message .="Retire to Summerside Prince Edward Island<br>\n"; $message .="<a href='http://www.website.com/articles/10.html' target='_blank'>[Read]</a><br><br>\n"; $message .="Acquiring PEI Real Estate as a Non Resident<br>\n"; $message .="<a href='http://www.website.com/articles/6.html' target='_blank'>[Read]</a><br><br>\n"; $message .="Properties without Services<br>\n"; $message .="<a href='http://www.website.com/articles/5.html' target='_blank'>[Read]</a><br><br>\n"; Link to comment https://forums.phpfreaks.com/topic/131349-solved-concatenating-a-string-variable-within-lines/#findComment-682068 Share on other sites More sharing options...
coutts Posted November 4, 2008 Author Share Posted November 4, 2008 Hi Putting the \n at the end of the line comes through ie OE will actually show the \n. What I am trying to do is the same that you can do in Visual Basic by ending a line with "& vbCrlf" like this message = "Blah Blah Blah<br>" & vbCrLf what I really want to do to use an old fashioned term is add a carriage return Thanks Link to comment https://forums.phpfreaks.com/topic/131349-solved-concatenating-a-string-variable-within-lines/#findComment-682080 Share on other sites More sharing options...
Yesideez Posted November 4, 2008 Share Posted November 4, 2008 Try... $message="1st line 2nd line 3rd line"; I think that works... Link to comment https://forums.phpfreaks.com/topic/131349-solved-concatenating-a-string-variable-within-lines/#findComment-682085 Share on other sites More sharing options...
trq Posted November 4, 2008 Share Posted November 4, 2008 Putting the \n at the end of the line comes through ie OE will actually show the \n. Not if your strings are within double quotes. what I really want to do to use an old fashioned term is add a carriage return Which is exactly what \n is. Link to comment https://forums.phpfreaks.com/topic/131349-solved-concatenating-a-string-variable-within-lines/#findComment-682086 Share on other sites More sharing options...
PFMaBiSmAd Posted November 4, 2008 Share Posted November 4, 2008 A \r\n should work in Microsoft products. Link to comment https://forums.phpfreaks.com/topic/131349-solved-concatenating-a-string-variable-within-lines/#findComment-682090 Share on other sites More sharing options...
rhodesa Posted November 4, 2008 Share Posted November 4, 2008 \r = Carriage Return \n = Line Feed ...use as needed Link to comment https://forums.phpfreaks.com/topic/131349-solved-concatenating-a-string-variable-within-lines/#findComment-682091 Share on other sites More sharing options...
coutts Posted November 4, 2008 Author Share Posted November 4, 2008 Thanks Everyone: I used $message="1st line 2nd line 3rd line"; and this seemed to work for me - I did try using \r and \n within "" and it reproduced in OE like This is my line of text \n However everything is solved now Thanks Again Link to comment https://forums.phpfreaks.com/topic/131349-solved-concatenating-a-string-variable-within-lines/#findComment-682176 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.