was wondering if someone out there could tell me how to display a variable in php html email….?
I have a form with inputs…that is then processed and the inputs put in variables then put into an html email template and emailed across…if you just use ehco/print the variable i can’t control the width or display line breaks….so i have textareas with the intial values being the variable…this displaying the line breaks and controlling the width for appearance…the text areas are set not to show borders and scroll bars but have a pre-determined hieght (to avoid showing the scroll bars as this will be printed off when recieved)…taking up much hieght on the form when printing it.
so i was wondering if there is a better way to display the variables in cleaner more attractive way ? The part that i am getting really stumped with is displaying the line breaks and its an html form so the options are limited.
I am sure somone has come across this before…but i am pulling my hair out here ! any help would be greatly appreaciated !
Typically when displaying pre-formatted text, you want to wrap said text in
<pre></pre>tags:Edit:
As mentioned by sdolgy, you should escape any HTML within your text. I have updated the above code to reflect that point.