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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.