Return to Snippet

Revision: 18077
at September 22, 2009 10:48 by dmautz1

Initial Code
$headers = "Content-Type: text/html; charset=iso-8859-1\n";
$to = "[email protected]";
$subject = "New Form Submission";

// set html email content
$text = "<html><body>The form details are listed below:<br><br><table>";

// loop through POST
foreach($_POST as $key => $value)
		if(strstr($key, "phone") || strstr($key,"fax")){
			$value = implode("-",$value);
			$value = implode(",",$value);
	$text .= "<tr><td>".$key."</td><td>".$value."</td></tr>";
$text .= "</table></body></html>";

// you may need to add some form inputs manually depending on your setup

//email admin to notify of new submission
mail($to, $subject, $text, $headers);

Initial URL

Initial Description
I use this to activate basic forms for clients. Just make sure your form input names are named appropriately.  Any inputs such as phone or fax that are separated into different inputs should have the same name.

Initial Title
HTML Email Form $_POST Contents

Initial Tags
form, email, post

Initial Language