Jump to content

$message function (PLZ HELP SO EASY)


farnoise

Recommended Posts

Hi,

I have this code, Can any body tell me how can I send the output of $language into mail? This is a code that recieve the variable for bunch of check boxes from MY HTML form and echo the in my page but If you see bottom of the page i Have $message function that sends and e-mail to visitor with his list but I dont know how can I add this lists into my $message body. this PHP code is proccessing a HTML form and sends an email to me and to visitor, everything works fine except that part.

 

 

This is where php check my boxes

 

________$LANGUAGE___________

 

if(isset($_POST['language']))

{

  $language = $_POST['language'];

  $n        = count($language);

  $i        = 0;

 

  echo "The languages you selected are \r\n" .

        "<ol>";

  while ($i < $n)

  {

      echo "<li>{$language[$i]}</li> \r\n";

      $i++;

  }

  echo "</ol>";

}

 

__________________________

 

 

 

____$MESSAGE______

 

$message = " New list has been submited

 

              $firstname , $lastname

              Start date: $date

Your list is:

I NEED THE CODE HERE  "

 

...........Rest of the code.............

 

 

____$MESSAGE______

 

 

 

Thanks a lot guys

Link to comment
https://forums.phpfreaks.com/topic/183627-message-function-plz-help-so-easy/
Share on other sites

Do you need to echo the list as well as send it in the message? If so it would be preferable to use output buffering. Ex:

 

if(isset($_POST['language']))
{
   ob_start();
   $language = $_POST['language'];
   $n        = count($language);
   $i        = 0;

   echo "The languages you selected are \r\n" .
        "<ol>";
   while ($i < $n)
   {
      echo "<li>{$language[$i]}</li> \r\n";
      $i++;
   }
   echo "</ol>";
   $list = ob_get_contents();
}

 

You can then use $list inside of $message.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.