如何使用PHP电子邮件和格式化处理过的页面?

I have a "print" button, I wan't an "email" button also. I want to email the content of the page that appears after I click "Click To Add"(input type="image") on the order form. It's basically just an order form with multiple "number" input types that I want to format and email those quantities. Do i need to convert the whole page to PDF first? I will have multiple forms(styles of apparel) that will be processed. Thanks!

Link to test page: http://taketwodesigns.com/monkeypod/order/


    <!---------------------- 1ST STYLE BELOW ----------------------------->
 <form action="processors/process_xs-xxl.php" method="post" name="order_form1" class="margins">

<div class="item_image_container">
<span class="item_name">Item ~ MLTA107-101TEV</span>
<a href="images/styles/large/mlta107_101tev_big.jpg" target="_blank"><img class="item_image" src="images/styles/thumbs/mlta107_101tev_thumb.jpg" /></a>
<span class="click_full_image">Click image for full size</span>
</div><!-- ITEM_IMAGE div CLOSE -->

<table border="1" cellspacing="1">
<tr class="gridaddrows">
<td colspan=8 class="radius">
<div class="formtext"><b>You must click the "Add to Cart" button to place items in cart.</b></div>
</td>
</tr>
<tr class="gridrows">
<td class="gridtitle">Add</td>
<td class="gridtitle">XS</td>
<td class="gridtitle">S</td>
<td class="gridtitle">M</td>
<td class="gridtitle">L</td>
<td class="gridtitle"></td>
<td class="gridtitle"></td>
</tr>

<td class="add_to_cart_btn">
<input type="image" src="../order/images/clicktoadd83pxfast.gif"  name="mlta107_101tev" alt="Add to Cart" /></td>

<td><span class="price">$11.25</span><br>
<input type="number" name="xs" placeholder="Qty" min="0" max="288" autocomplete="off"></td>

<td><span class="price">$11.25</span><br>
<input type="number" name="sm" placeholder="Qty" min="0" max="288" autocomplete="off"></td>

<td><span class="price">$11.25</span><br>
<input type="number" name="md" placeholder="Qty" min="0" max="288" autocomplete="off"></td>

<td><span class="price">$11.25</span><br>
<input type="number" name="lg" placeholder="Qty" min="0" max="288"  autocomplete="off"></td>

<td><!-- span class="price">$11.25</span><br -->
<input type="number" name="xl" placeholder="Qty" min="0" max="288" style="visibility: hidden;" autocomplete="off"></td>

<td><!-- span class="price">$11.25</span><br -->
<input type="number" name="xxl" placeholder="Qty" min="0" max="288" style="visibility: hidden;" autocomplete="off"></td>

</table>
</form>



<!DOCTYPE html>               <!-- process_xs-xxl.php -->
<html>
<head>
<title>MPK MLTA107-101TEV</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
<meta content="width=device-width, initial-scale=1, user-scalable=yes" name="viewport" />   
<link rel="stylesheet" href="../css/cart.css" type="text/css" />
<link href='https://fonts.googleapis.com/css?family=Open+Sans:700,600' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="css/print.css" media="print">
</head>
<body>

<div id="divToPrint">

<h1>MONKEYPOD KITCHEN ONLINE ORDERING</h1>

<?php

date_default_timezone_set('Pacific/Honolulu');
$date = date("l, F jS Y g:i:s A");

$xs  = $_POST['xs'];
$sm  = $_POST['sm'];
$md  = $_POST['md'];
$lg  = $_POST['lg'];
$xl  = $_POST['xl'];
$xxl = $_POST['xxl'];

    if($_POST['xs'] ||
       $_POST['sm'] ||
       $_POST['md'] ||
       $_POST['lg'] || 
       $_POST['xl'] ||
       $_POST['xxl'] ){ 

$xs  = ltrim($xs, '0');
$sm  = ltrim($sm, '0');
$md  = ltrim($md, '0');
$lg  = ltrim($lg, '0');
$xl  = ltrim($xl, '0');
$xxl = ltrim($xxl, '0');

    echo '<h6 class="great">Thank you for your order!</h6>';

    echo "<hr>";

    echo "<h5>Your order date is:<br>$date<br>Hawaiian Time! Mahalo!</h5>";

    echo "<ul><h3>Ordered Items Below</h3><h4>Item# MLTA107-101TEV</h4>";

    echo "<li>" . $xs .  "&nbsp; -&nbsp; X-Small" . "</li>";
    echo "<li>" . $sm . "&nbsp; -&nbsp; Small" . "</li>";
    echo "<li>" . $md . "&nbsp; -&nbsp; Medium" . "</li>";
    echo "<li>" . $lg . "&nbsp; -&nbsp; Large" . "</li>";
    echo "<li>" . $xl . "&nbsp; -&nbsp; X-Large" . "</li>";
    echo "<li>" . $xxl . "&nbsp; -&nbsp; XX-Large" . "</li>";

    echo "</ul>";

    }else{  
            echo '<h2>Oppsiedasies! It looks like you didn\'t order anything!<br>Back to <a href=".">shop home</a></h2>';
        }               
?>

<?php
    echo '<div class="print_button_div"><input type="button" value="Print Order" onclick="PrintDiv();" /></div>';   
?>

<?php

echo '<a href="mailto:example@cox.net?subject=Summer%20Party&body=$xs%20You%20are%20invited%20to%20a%20big%20summer%20party!" target="_top">Send mail!</a>';

?>

<h5>Test for echo....<br>Back to <a href=".">shop home</a></h5>

</div><!-- TO PRINT div CLOSE -->

<script type="text/javascript">     
    function PrintDiv() {    
       var divToPrint = document.getElementById('divToPrint');
       var popupWin = window.open('', '_blank', 'width=800,height=800,background-color=red');
           popupWin.document.open();
           popupWin.document.write('<html><head><style></style></head><body onload="window.print()">' + divToPrint.innerHTML + '</html>');
           popupWin.document.close();
    }
</script>

</body>
</html>

As I mentioned in comments, you can use output buffering to capture content sent by email. There's no need to create an additional PDF for this.

You simply take the assigned variable to ob_get_contents() and use that as the mail body.

Here is a very basic example (pulled from this page), but you will need to experiment with this by simply placing what you need to capture between ob_start(); and ob_end_clean();.

<?php

  // Start buffering
  ob_start();

  // Output stuff (probably not this simple, might be custom CMS functions...
  echo 'Print to the screen!!!';
  echo "<br>Print this to screen also.";

  // Get value of buffering so far
  $getContent = ob_get_contents();

  // Stop buffering
  ob_end_clean();

  // Do stuff to $getContent as needed

  // Use it
  echo 'Now: ' . $getContent;

?>

The $getContent variable would be used as the mail body parameter.

Example using PHP's mail() function:

mail($to, $subject, $getContent, $headers);

Reference:

And remember to send as HTML, since you are using HTML here.

You can also use phpmailer https://github.com/PHPMailer/PHPMailer

Foonotes:

You have an unclosed <h5> tag in shop home</a></h5 <<< right there.

I noticed you are using images. You may have to use a full HTTP call for those.

I.e.:

<a href="http://www.example.com/images/styles/large/mlta107_101tev_big.jpg" target="_blank"><img class="item_image" src="http://www.example.com/images/styles/thumbs/mlta107_101tev_thumb.jpg" /></a>

To send mail taken from a form, you would need to use PHP for that, rather than the <a href="mailto:example@cox.net?subject=Summer... link you're using here.

Have a look at PHP's forms tutorial