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>"; Quote 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"; Quote 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 Quote 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... Quote 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. Quote 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. Quote 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 Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.