<?php
//lines that start with two slashes are comments.

// copy and paste this text into a file named "formProcessor.php" and set that as the action on your form.
// do not copy the source, copy it from the browser window.


// these will help if there are any errors.
error_reporting(E_ALL);
ini_set("display_errors", 1);

// here we go through each field and add it to $output, in a table.
$output = "<table cellpadding='4'>";
foreach($_POST as $key => $value) {
	$output .= "<tr><th>$key</th><td>$value</td>";
}
$output .= "</table>";

// this is where the email will go to. You should change this to your own email address.
$to = "ABrown@ce.rmcad.edu";
// this is information that the email function will need. you can change my email address to anything you want, just leave the \r\n intact.
$headers = "From: ABrown@ce.rmcad.edu\r\nContent-type: text/html; charset=utf-8\r\n";
// you should recognize everything on this line below. this is the line that actually sends the email.
mail($to, 'CE174 Form results - between these quotes is the subject line of the email.', $output, $headers);

// this is how the user gets redirected to your next page. you can change the filename to anything you want.
header("Location: thankYou.html");