Hallo,
ik heb een contactform dat prima werkt met een php script.
alleen wil ik de resultaten van de ingevulde velden in een tabel verwerken zodat alles netjes uitgelijnd in de verstuurde mail komt staan.
Maar ik weet niet hoe ik dat moet doen, kan iemand mij hiermee helpen?
Dit is de code van het formulier
<?php if(isset($_POST['email'])) {
$email_to = "[email protected]";
$email_subject = "offerte ";
function died($error) {
// your error code can go here
echo "We are very sorry, but there were error(s) found with the form you submitted. ";
echo "These errors appear below.<br /><br />"; echo $error."<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
}
// validation expected data exists
if(!isset($_POST['date']) ||
!isset($_POST['date1']) ||
!isset($_POST['name']) ||
!isset($_POST['adres']) ||
!isset($_POST['zippcode']) ||
!isset($_POST['place']) ||
!isset($_POST['email']) ||
!isset($_POST['telephone']) ||
!isset($_POST['comments'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$date = $_POST['date']; // not required
$date1 = $_POST['date1']; // not required
$name = $_POST['name']; // not required
$adres = $_POST['adres']; // not required
$zippcode = $_POST['zippcode']; // not required
$place = $_POST['place']; // not required
$email = $_POST['email']; // not required
$telephone = $_POST['telephone']; // not required
$comments = $_POST['comments']; // not required
$error_message = "";
$email_exp = "^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$";
if(!eregi($email_exp,$email)) {
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
}
$string_exp = "^[a-z0-9 ,.'-]+$";
if(!eregi($string_exp,$date)) { $error_message .= 'The Date you entered does not appear to be valid.<br />';}
$string_exp = "^[a-z0-9 ,.'-]+$";
if(!eregi($string_exp,$date1)) { $error_message .= 'The Date1 you entered does not appear to be valid.<br />';}
$string_exp = "^[a-z0-9 .'-]+$";
if(!eregi($string_exp,$name)) { $error_message .= 'The Name you entered does not appear to be valid.<br />';}
$string_exp = "^[a-z0-9 .'-]+$";
if(!eregi($string_exp,$adres)) { $error_message .= 'The Adres you entered does not appear to be valid.<br />';}
$string_exp = "^[a-z0-9 .'-]+$";
if(!eregi($string_exp,$zippcode)) { $error_message .= 'The Zippcode you entered does not appear to be valid.<br />';}
$string_exp = "^[a-z0-9 .'-]+$";
if(!eregi($string_exp,$place)) { $error_message .= 'The Place you entered does not appear to be valid.<br />';}
$string_exp = "^[a-z0-9 .'-]+$";
if(!eregi($string_exp,$telephone)) { $error_message .= 'The Number you entered does not appear to be valid.<br />';}
$string_exp = "^[a-z0-9 .'-]+$";
if(strlen($comments) < 2) { $error_message .= 'The Comments you entered do not appear to be valid.<br />';}
if(strlen($error_message) > 0)
{ died($error_message); }
$email_message = "Form details below.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "Datum : ".clean_string($date)."\n";
$email_message .= "Datum feest : ".clean_string($date1)."\n";
$email_message .= "Naam : ".clean_string($name)."\n";
$email_message .= "Adres : ".clean_string($adres)."\n";
$email_message .= "Postcode : ".clean_string($zippcode)."\n";
$email_message .= "Woonplaats : ".clean_string($place)."\n";
$email_message .= "Email : ".clean_string($email)."\n";
$email_message .= "Telefoon : ".clean_string($telephone)."\n";
$email_message .= "opmerkingen : ".clean_string($comments)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="yes" name="apple-mobile-web-app-capable" />
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type" />
<link href="pics/apple-touch-icon.png" rel="apple-touch-icon" />
<meta content="minimum-scale=1.0, width=device-width, maximum-scale=0.6667, user-scalable=no" name="viewport" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script src="javascipt/functions.js" type="text/javascript"></script>
<title></title>
<meta content="iPod,iPhone,Webkit,iWebkit,Website,Create,mobile,Tutorial,free" name="Keywords" />
<meta content="" name="description" />
</head>
<body>
<div id="topbar">
<div id="leftnav">
<a href="index.html"><img alt="home" title="home" src="images/home.png" /></a></div>
<div id="title"> <img alt="plas"src="thumbs/recr.png" /></div>
<div id="rightbutton">
<a href="actueel.htm" title="Contact geslaagd">News</a></div>
</div>
<div id="content">
<span class="graytitle">Hartelijk dank!</span>
<ul class="pageitem">
<li class="textbox">
<p>Uw formulier is met succes verzonden.
</p>
</li>
</ul>
</div>
<div id="footer">
</div>
</body>
</html> <? } ?>
1.819 views