PHP Question on formatting Form Mail (I'm a rookie)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Asheron
Forum Newbie
Posts: 3
Joined: Thu Jun 02, 2005 10:06 am

PHP Question on formatting Form Mail (I'm a rookie)

Post by Asheron »

Using the following code how would I
1) bold the $Field (when it's being send in email)
2) make it print more than one field on the same line (could I stick that into a character per line check?)

Code: Select all

<?php 

foreach ($_POST as $Field=>$Value)
   {
	if(!empty($Value)){$MsgBody .= "$Field: $Value\n";} 
   }
?>
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

As far as I've researched, you can't bold text unless you go to html emails (which is a bad idea anyway). As for putting multiple fields on 1 line, just remove \n from the end of what you add, and put it in with a particular condition.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
Skara
Forum Regular
Posts: 703
Joined: Sat Mar 12, 2005 7:13 pm
Location: US

Post by Skara »

pickle wrote:...unless you go to html emails (which is a bad idea anyway).
Unless you're just emailing yourself, such as a support ticket. ;)

Instead of bold, just slash words: "If you /really/ like this..." or "I read the book _Whatever_."
:P If that's an option, of course.
Post Reply