Connecting Tech Pros Worldwide Forums | Help | Site Map

If Statements in PHP Mail's HTML Messages?

chunk1978's Avatar
Familiar Sight
 
Join Date: Jan 2007
Posts: 226
#1: Apr 9 '07
is it possible to dynamically change the HTML message inside PHP's mail() function sent from a form? i had something previously written in javascript but i guess it's not a smart idea to include javascript in a .php mail script...

so within the "$message" part of the mail script, would i write something like this:

Expand|Select|Wrap|Line Numbers
  1. $message = '
  2. echo "<html>\n"; 
  3. echo "<body>\n"; 
  4. if ($_POST['AdditionalComments'] !="")
  5. {
  6. echo "This was your comment that you wrote on our website:"\n;
  7. echo "'$AdditionalComments'"\n;
  8. echo "</body>\n"; 
  9. echo "</html>\n";
  10. ';
  11.  
would totally appreciate help with this...

Reply