Mail med flere felter
Hej alle sammen:) Jeg er ved at lave en form med flere felter men kan ikke få den til at virke. Skal også have php validering på men rækkefølgen i koden giver fejl , desværre.Her er min kode;
<?php
ob_start();
require_once('includes/config.php');
?>
<!DOCTYPE HTML>
<head>
<meta name="viewport" content="width = device-width; initial-scale = 1.0; maximum-scale=1.0;" />
<title>Forside :: </title>
<link href="css/marko.css" rel="stylesheet" type="text/css" media="screen" />
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script>
$(function() {
$( "#datepicker" ).datepicker({
showWeek: true,
firstDay: 1
});
});
</script>
<link href="css/jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<div id="wrapper">
<div id="banner"></div>
<div id="menu">
<?php
require_once('includes/mux.php');
?>
</div><!--menu-->
<div id="content">
<div id="booking">
<?php
function isValidEmail($email)
{
return preg_match('/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+){2,4}+$/', $email);
}
//if( strlen(!empty($navn)) &&
// isValidEmail($email) &&
// is_numeric(!empty($tlf) <=8) &&
// !empty($dato) &&
// is_numeric(!empty($antaldeltag)) &&
// is_numeric(!empty($antaltimer)) &&
// strlen(!empty($msg))
// {
// echo "Beskeden er sendt";
//
// }else{ echo "Udfyld venligst felterne korrekt"; }
$mymail = "my@mail.com";
$subject = "Kundemail";
if (isset($_REQUEST['submail'] )) //if "email" is filled out, send email
{
//send email
$navn = $_REQUEST['navn'] ;
$email = $_REQUEST['email'] ;
$tlf = $_REQUEST['tlf'] ;
$dato = $_REQUEST['dato'] ;
$antaldeltag = $_REQUEST['antaldeltag'] ;
$antaltimer = $_REQUEST['antaltimer'] ;
$message = $_REQUEST['message'] ;
$info = "$message\n$subject\n$antaltimer\n$antaldeltag\n$dato\n$tlf\n$navn";
$headers = 'From: '. $email . "\r\n" . 'Reply-To: '.$email.'' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail($mymail, $subject, $info, $headers);
}else{
?>
<form method='post' action='tak.php'>
<table>
<tr><td><input name="subject" type="hidden"></td></tr>
<tr><td style="width:120px;">Navn:</td>
<td><input name='navn' type='text' alt="Indtast navn" title="Indtast navn" /></td> </tr>
<tr><td>Email:</td><td> <input name='email' type='text' alt="Indtast email" title="Indtast email" /></td></tr>
<tr><td>Tlf.:</td><td> <input name='tlf' type='text' alt="Indtast Tlf. nr." title="Indtast tlf. nr." /></td></tr>
<tr><td>Dato:</td><td> <input name='dato' type='text' id="datepicker" alt="Vælg dato for arrangement" title="Vælg dato for arrangement" /></td></tr>
<tr><td>Antal deltagere:</td>
<td> <input name='antaldeltag' type='text' alt="Antal deltagere" title="Antal deltagere" /></td></tr>
<tr><td>Antal timer:</td><td> <input name='antaltimer' type='text' alt="Arrangementets varighed" title="Arrangementets varighed" /></td></tr>
</table>
<br />Kort beskrivelse af arrangementet:
<textarea name='message' rows='10' cols='40'></textarea><br /><br />
<input type='submit' value="Book en dj" id="submail" alt="Send mail" title="Send mail"/>
</form>
<?php
}
?>
</div>
</div><!--content-->
<div id="footer">
<?php
require_once('includes/footer.php');
?>
</div><!--footer-->
</div><!--wrapper-->
</body>
</html>
<?php
ob_flush();
?>