Any PHP programming gurus?
Options
sunrise611
Posts: 1,911 Member
in Chit-Chat
I am trying to do something that should be simple in PHP and it's not working.
I simply want to change a small snippet of code to include line breaks such as <br> or <p> in an outputted email message.
If you know PHP and think you can help, contact me.
Thanks!
I simply want to change a small snippet of code to include line breaks such as <br> or <p> in an outputted email message.
If you know PHP and think you can help, contact me.
Thanks!
0
Replies
-
Uhhh I’m only pretending to know what I’m talking about here, but I think what you are looking for is either /n or <br />. I believe one is a line break in the code and the other shows a line break in the actual output...
If I’m right, that would be both excellent and nerdy.0 -
If you are printing a line.
print 'what you want'.'<br />'.'More of what you want.'
You can concatenate with a dot . i am not sure if you have any dynamic code from a database - but google concatenate if you need to. Text needs quotes. Depending on which version of PHP you need to escape some characters a \. IE: \<br \>0 -
\n moves to the next line with PHP
*edit to add, you can repeat this
\n
\n
\n
if you want0 -
Uhhh I’m only pretending to know what I’m talking about here, but I think what you are looking for is either /n or <br />. I believe one is a line break in the code and the other shows a line break in the actual output...
If I’m right, that would be both excellent and nerdy.
Uhh...you are using the handle _GlaDOS_. You have therefore already obtained "excellent and nerdy" status.0 -
php you can mix html with the code you don't need to do the print
<?php
......
$message = '
<html>
<head>
<title>hi</title>
</head>
<body>
<p>MFP RULEs!</p>
this has a line break <br/><br/>
</body>
</html>
';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Mail it
mail($to, $subject, $message, $headers);
?>
Jess is correct that proper xhtml requires you to close your br but that is likely not the issue.
<br/>0 -
This is driving me crazy, i am having a brain fart. One of my majors is CS (Computer science) I am trying to remember the proper name of those things.
cout << "/"" << endl;
i want to say delimiter but that's not it.
lol I think we are in the same boat. Instead of highschool I went to a votech and did computer programming and web/graphic design but when I hit the job force all I have landed is hardware jobs and I know this stuff is in my head somewhere. somewhere being the key word.0 -
Bump !0
-
This is driving me crazy, i am having a brain fart. One of my majors is CS (Computer science) I am trying to remember the proper name of those things.
cout << "/"" << endl;
i want to say delimiter but that's not it.
I/O Redirection?0 -
This is driving me crazy, i am having a brain fart. One of my majors is CS (Computer science) I am trying to remember the proper name of those things.
cout << "/"" << endl;
i want to say delimiter but that's not it.
lol I think we are in the same boat. Instead of highschool I went to a votech and did computer programming and web/graphic design but when I hit the job force all I have landed is hardware jobs and I know this stuff is in my head somewhere. somewhere being the key word.
"ESCAPES!" that's it. it was driving me crazy.
Yeah i had a computer repair business, I don't like hardware work.
I liked software but I burn so many more calories lugging servers up and down stairs0 -
\n moves to the next line with PHP
*edit to add, you can repeat this
\n
\n
\n
if you want
Thanks. I'll see if I can get that to work.0 -
php you can mix html with the code you don't need to do the print
<?php
......
$message = '
<html>
<head>
<title>hi</title>
</head>
<body>
<p>MFP RULEs!</p>
this has a line break <br/><br/>
</body>
</html>
';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Mail it
mail($to, $subject, $message, $headers);
?>
Jess is correct that proper xhtml requires you to close your br but that is likely not the issue.
<br/>
Hi RocketPants, I tried this code and it didn't work. The code that the original programmer used is more complicated and I'm trying to simplify and work within those parameters.
This is the code:
$mailMessage = __("Greetings from My Site! You received a new message from", "name")." ".$sendfrom.", ".__("You can read the message at", "name").": ".$this->pageURL;
I want a line break after "Greetings from My Site!" (Names changed for privacy.)
It would also be nice to have a line break after "You received a new message from ___."
I'll try this and see if it works:
$mailMessage = __("Greetings from My Site! \n \n You received a new message from", "name" \n \n)." ".$sendfrom.", ".__("You can read the message at", "name").": ".$this->pageURL;
Let me know if you see a problem with this and how you would code it. Thanks!0
Categories
- All Categories
- 1.4M Health, Wellness and Goals
- 391.9K Introduce Yourself
- 43.5K Getting Started
- 259.8K Health and Weight Loss
- 175.7K Food and Nutrition
- 47.3K Recipes
- 232.3K Fitness and Exercise
- 399 Sleep, Mindfulness and Overall Wellness
- 6.4K Goal: Maintaining Weight
- 8.5K Goal: Gaining Weight and Body Building
- 152.8K Motivation and Support
- 7.9K Challenges
- 1.3K Debate Club
- 96.3K Chit-Chat
- 2.5K Fun and Games
- 3.4K MyFitnessPal Information
- 23 News and Announcements
- 979 Feature Suggestions and Ideas
- 2.4K MyFitnessPal Tech Support Questions