Two basic steps:
1) Submit the data that you requested using an HTML form
with the POST
method. We'll assume that you are keeping this data in a form field named 'plans'
.
2) You can then use the mail()
function in PHP. Here is an altered example from the mail() PHP Manual Page:
<?php
//This belongs in whichever file is called by your HTML form
$to = 'yourtarget@example.com';
$subject = 'Plans';
//Retrieve the plan contents from the form's posted data
$message = $_POST['plans_field'];
$headers = 'From: webmaster@example.com' . "\r\n" .
'Reply-To: webmaster@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
Edit: To get the actual table contents I would probably use some jQuery. Let's assume your table looks like this:
<table>
<tr><td id="plan_data">Here is all of your plan data!</td></tr>
</table>
In addition, you will have a hidden field in your form (since you aren't requesting the user actually provide the data themselves, we will use a hidden field).
<form>
<input type="hidden" id="plans_field" name="plans_field" value="" />
<input type="submit" id="submit" />
</form>
We'll intercept the form submission (since the hidden field is current an empty string) and, using jQuery, we'll populate the hidden field's value with the table cell contents:
$(document).ready(function() {
$("#submit").on("click", function() {
$("#plans_field").val($("#plan_data").html());
});
});
The line inside the on click function might look a bit lengthy, but it's basically saying: "I want to set the value of the hidden plans_field to the contents of the plan_data cell."
Please remember that these are just examples and that my answer is not foolproof: a browser with JavaScript disabled would be able to submit that form and the empty string would remain, so some error checking on your end would be a good idea.