What if the contents of the variable echo are stored in a variable?

Source: Internet
Author: User
This post was last edited by u011552243 on 2013-08-20 20:08:40

PHP echo Email

Problem background: I want to output a form and email this form as content.
Problem: Code First,
$message = '
 
 

'; $message. = ' Driver: '; $message. = $firstName. ' '. $lastName; $message. = '

Date: '. $orderTime. '

No:1

Car '. $truck. ': '. ' '. $licNum; $message. = '

Kund: '. $customerName. '

Order: '. $orderNum. '

'; $message. = ' Book Number: '. $bookNumPick. '

Produktnamn: '. $productName. '

Chassi: '; $message. = $tankName. '

Tank number: '. $chassi. '

Place: '. $locationPick. '

Place 2: '; $message. = $portCodePick. '

Place 3: '. $locationUnload. '

Place 4: '; $message. = $timeUnload. '

Place 5: '. $ADRclass. '

Place 5: '. $weight. '

Place 6: '; $message. = $locationLoad. '

Place 7: '. $loadTime. '

Place 8: '; $message. = '

'. $info. '

Place 9: '. $outE. '

Place ten: '. $bookNumOut. '

Place 11: '; $message. = $portCodeOut. '

'; echo $message. "
"; $to = $email; $subject = "Task"; $from = EMAIL; $headers = "From: $from"; echo $headers. "
"; Mail ($to, $subject, $message, $headers);

To illustrate, I used double quotation marks at the beginning, and later, in order to keep the contents of the $message in double quotes, I changed the outer double quotation marks to single quotes.

In fact, I want the content of the email to be the result of Echo $message. But using the mail () function to send the $message directly, the results received are:

。。。。 (omitted, visible $message) .....


Directly is the content inside the $message directly sent out, rather than the echo $message after the results of the outgoing.
What to do?
If convenient, can you point to the key code snippets or examples, thank you very much.


Reply to discussion (solution)

Problem background: I want to output a form and email this form as content.
Problem: Code First,

$message = '
 
 

'; $message. = ' Driver: '; $message. = $firstName. ' '. $lastName; $message. = '

Date: '. $orderTime. '

No:1

Car '. $truck. ': '. ' '. $licNum; $message. = '

Kund: '. $customerName. '

Order: '. $orderNum. '

'; $message. = ' Book Number: '. $bookNumPick. '

Produktnamn: '. $productName. '

Chassi: '; $message. = $tankName. '

Tank number: '. $chassi. '

Place: '. $locationPick. '

Place 2: '; $message. = $portCodePick. '

Place 3: '. $locationUnload. '

Place 4: '; $message. = $timeUnload. '

Place 5: '. $ADRclass. '

Place 5: '. $weight. '

Place 6: '; $message. = $locationLoad. '

Place 7: '. $loadTime. '

Place 8: '; $message. = '

'. $info. '

Place 9: '. $outE. '

Place ten: '. $bookNumOut. '

Place 11: '; $message. = $portCodeOut. '

'; echo $message. "
"; $to = $email; $subject = "Task"; $from = EMAIL; $headers = "From: $from"; echo $headers. "
"; Mail ($to, $subject, $message, $headers);

To illustrate, I used double quotation marks at the beginning, and later, in order to keep the contents of the $message in double quotes, I changed the outer double quotation marks to single quotes.

In fact, I want the content of the email to be the result of Echo $message. But using the mail () function to send the $message directly, the results received are:

。。。。 (omitted, visible $message) .....


Directly is the content inside the $message directly sent out, rather than the echo $message after the results of the outgoing.
What to do?
If convenient, can you point to the key code snippets or examples, thank you very much.

Solve it yourself. where $headers = "From: $from". "\ r \ n";;
$headers. = "mime-version:1.0\n". "Content-type:text/html; Charset=utf-8 ' ";
Can. Knot stickers.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.