<?php

include ("includes/functions.php");

if ($_POST['versturen']) 
	{ 
 	form_controle();
	}
if ($_GET['s'] == "ok") 
	{ 
	$vermelding = "<p><b><font color='#FF0000'>Bedankt om deze enquete in te vullen!</font></b></p>"; 
	} else { 
	$vermelding = ""; 
	}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Het Kompas :: Enquete Invulformulier</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<? MetaStuff (); ?>
<link href="style.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" language="JavaScript">
<!-- Copyright 2003 Bontrager Connection, LLC
// Code obtained from http://WillMaster.com/
//
// Each required form field can be checked with JavaScript. Here are 
//    the function names for the different kinds of checks:
//
//       1. WithoutContent() -- check if the text, textarea, password, 
//              or file fields has no content.
//       2. NoneWithContent() -- check if none of the set of text, 
//              textarea, password, or file fields have content. 
//              (Set: More than one with the same field name.)
//
//       3. NoneWithCheck() -- check if none of the set of radio buttons 
//              or checkboxes are checked. (Set: More than one with the 
//              same field name.)
//       4. WithoutCheck() -- check if the single radio button or checkbox 
//              is unchecked.
//
//       5. WithoutSelectionValue() -- check if selected drop-down list or 
//              select box entries have no value.
//
//
// The format for using the above functions is
//             if(       WithoutContent([FORMFIELDVALUE])) [ERRORMESSAGE]
//             if(      NoneWithContent([FORMFIELD])     ) [ERRORMESSAGE]
//             if(        NoneWithCheck([FORMFIELD])     ) [ERRORMESSAGE]
//             if(         WithoutCheck([FORMFIELD])     ) [ERRORMESSAGE]
//             if(WithoutSelectionValue([FORMFIELD])     ) [ERRORMESSAGE]
//
// The if(...) part and the error message part may be on separate lines, like
//             if(WithoutContent([FORMFIELDVALUE]))
//                [ERRORMESSAGE]
//             if(NoneWithContent([FORMFIELD]))
//                [ERRORMESSAGE]
//             if(NoneWithCheck([FORMFIELD]))
//                [ERRORMESSAGE]
//             if(WithoutCheck([FORMFIELD]))
//                [ERRORMESSAGE]
//             if(WithoutSelectionValue([FORMFIELD]))
//                [ERRORMESSAGE]
//
//
//      FORMFIELD -- The format for specifying a "form field" is 
//                         document.[FORMNAME].[FIELDNAME]
// FORMFIELDVALUE -- The format for specifying a "form field value" is 
//                         document.[FORMNAME].[FIELDNAME].value
//   ERRORMESSAGE -- The format for specifying an "error message" is
//                         { errormessage += "\n\n[MESSAGE]"; }
//                   If the message itself contains quotation marks, 
//                      they must be preceded with a back slash. 
//                      Example: \"
//
//
//      FORMNAME -- The name assigned to the form in the <FORM... tag. 
//     FIELDNAME -- The field name being checked.
// 
//
// For use with this JavaScript, the only non-alphanumeric character a 
//    fieldname may have is the underscore. Replace any hyphens, colons, 
//    spaces, or other non-alphanumeric characters in your field names 
//    with an underscore character.
//
//
// Put field checks into the function CheckRequiredFields(), in the order 
//    you want the fields checked.
//

function CheckRequiredFields() {
var errormessage = new String();
// Put field checks below this point.

if(WithoutContent(document.DataForm.naam.value))
	{ errormessage += "\n\nGelieve uw volledige naam op te geven."; }
if(WithoutContent(document.DataForm.email.value))
	{ errormessage += "\n\nGelieve uw e-mail adres in te geven."; }
if(WithoutContent(document.DataForm.datum.value))
	{ errormessage += "\n\nDatum van uw bezoek graag."; }	
if(WithoutContent(document.DataForm.uur.value))
	{ errormessage += "\n\nUur van uw bezoek graag."; }	
	

// Put field checks above this point.
if(errormessage.length > 2) {
	alert('NOTE:' + errormessage);
	return false;
	}
return true;
} // end of function CheckRequiredFields()


function WithoutContent(ss) {
if(ss.length > 0) { return false; }
return true;
}

function NoneWithContent(ss) {
for(var i = 0; i < ss.length; i++) {
	if(ss[i].value.length > 0) { return false; }
	}
return true;
}

function NoneWithCheck(ss) {
for(var i = 0; i < ss.length; i++) {
	if(ss[i].checked) { return false; }
	}
return true;
}

function WithoutCheck(ss) {
if(ss.checked) { return false; }
return true;
}

function WithoutSelectionValue(ss) {
for(var i = 0; i < ss.length; i++) {
	if(ss[i].selected) {
		if(ss[i].value.length) { return false; }
		}
	}
return true;
}

//-->
</script>

<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>

	<script type="text/javascript" src="Scripts/jquery-1.4.2.min.js"></script>
	<script type="text/javascript" src="Scripts/jquery.colorbox-min.js"></script>
	<script type="text/javascript" src="Scripts/enquete.js"></script>
   	<link rel="stylesheet" type="text/css" media="all" href="Scripts/colorbox.css" />
</head>
<body onload="MM_preloadImages('images/BlockMenu_o.jpg','images/BlockDrank_o.jpg','images/BlockEnquete_o.jpg','images/BlockCBon_o.jpg')">

  <div style='display: none'>
		<div id="inline_example1" align='center'><br />
		<span align=left>Wij horen graag hoe wij ons kunnen verbeteren</span><br />
		<span align=left>Kan u ons toelichten waarom A.U.B?</span><br/><br/>
		<textarea cols=30 rows=5 name="reason"></textarea>
		<br/>
		<br/>
		
		<input type='button' id='saveReason' value='Ga verder'/>
		<input type="hidden" name="reasonName" value="" />
        </div>
        </div>
        
<div align="center">
	<div id="Wrapper">
		<div id="Header">
			<div id="HeaderNavigContainer">
				<ul class="HeaderNavig">
					<li><a href="index.php">Welkom</a></li>
					<li><a href="reserveren.php">reserveren</a></li>
					<li><a href="fotogal.php">Foto's</a></li>
					<li><a href="artikels.php">Artikels &amp; Media</a></li>
					<li><a href="contact.php" id="current">Contacteer Ons</a></li>
					<li><a href="ligging.php">Praktisch &amp; Ligging</a></li>
				</ul>
			</div>
			<div class="langsel"><a href="enquete_fr.php">Fran&ccedil;ais</a></div>
		</div>
		<div id="SubHeader">&nbsp;</div>
		<div id="Content">
			<table width="100%" cellpadding="0" cellspacing="0">
				<tr>
					<td id="LeftSide">
						<div class="LeftSide">
						<? SubMenu (); ?>
						</div>
					</td>
					<td id="CenterPage">
						<div class="CenterPage">
							<h1>Enqu&ecirc;te</h1>
							<p><?php echo $vermelding; ?></p>
							<p><span class="error">*</span> = verplicht in te vullen<a href='javascript:' class='imageThumbnail'>&nbsp;</a></p>
							<form id="contactForm" action="enquete_test.php" name="DataForm" method="post" onSubmit="return CheckRequiredFields()">
							<ol>
							<li>
								<label>Datum van uw bezoek: (bv. maandag 30 Juni) <span class="error">*</span></label>
									<input type="text" name="datum" class="Inputbox" />
								</li>
								<li>
									<label>Uur van uw bezoek: (bv. 20u) <span class="error">*</span></label>
									<input type="text" name="uur" class="Inputbox" />
								</li>
								<li><label>Volledige naam: <span class="error">*</span></label>
							    	<input type="text" name="naam" class="Inputbox" />
								</li>
								<li><label>Email-adres: <span class="error">*</span></label>
									<input type="text" name="email"  class="Inputbox"/>
								</li>
								<li><label>Telefoon: </label>
									<input type="text" name="telnr"  class="Inputbox"/>
								</li>
								<li><label>Ik heb "Het Kompas" leren kennen via:</label>
									<select name="waarkentu" class="Inputbox">
										<option value="Zoekmachine">Zoekmachine resultaat</option>
										<option value="Mond-aan-mond">Mond-aan-mond</option>
										<option value="Aanbevolen door een van uw klanten">Aanbevolen door een van uw klanten</option>
										<option value="email marketing">E-mail marketing</option>
										<option value="Link op andere website(s)">Link op een andere website</option>
										<option value="Via Publiciteit">Via Publiciteit, Artikels, ...</option>
									</select>
								</li>
								<li><label>Waren er zaken die u stoorden tijdens uw aanwezigheid?</label>
									<input type="text" name="stoorden" class="Inputbox" />
								</li>
								<li><label>Hebt u suggesties voor ons?</label>
									<input type="text" name="suggesties" class="Inputbox" />
								</li>
								<li>
									<label>Geef uw mening hieronder</label>
									<table width="310" cellpadding="5" cellspacing="5" align="left">
										<tr>
											<th class="titel">&nbsp;</th>
											<th>onder-maats</th>
											<th>minder</th>
											<th>OK</th>
											<th>goed</th>
											<th class="noborder">perfect</th>
										</tr>
										<tr>
											<td class="titel">Onthaal: </td>
											<td align="center">
											<input type="hidden" name="OnthaalReason" value="" />
											<input type="radio" name="Onthaal" value="slecht" class="radio" /></td>
											<td><input type="radio" name="Onthaal" value="minder" class="radio" /></td>
											<td><input type="radio" name="Onthaal" value="OK" class="radio" /></td>
											<td><input type="radio" name="Onthaal" value="goed" class="radio" /></td>
											<td class="noborder"><input type="radio" name="Onthaal" value="perfect" class="radio" /></td>
										</tr>
										<tr>
											<td class="titel">Bediening: </td>
											<td>
											<input type="hidden" name="BedieningReason" value="" />
											<input type="radio" name="Bediening" value="slecht" class="radio" /></td>
											<td><input type="radio" name="Bediening" value="minder" class="radio" /></td>
											<td><input type="radio" name="Bediening" value="OK" class="radio" /></td>
											<td><input type="radio" name="Bediening" value="goed" class="radio" /></td>
											<td class="noborder"><input type="radio" name="Bediening" value="perfect" class="radio" /></td>
										</tr>
										<tr>
											<td class="titel">Sfeer, kader: </td>
											<td>
											<input type="hidden" name="SfeerReason" value="" />
											<input type="radio" name="Sfeer" value="slecht" class="radio" /></td>
											<td><input type="radio" name="Sfeer" value="minder" class="radio" /></td>
											<td><input type="radio" name="Sfeer" value="OK" class="radio" /></td>
											<td><input type="radio" name="Sfeer" value="goed" class="radio" /></td>
											<td class="noborder"><input type="radio" name="Sfeer" value="perfect" class="radio" /></td>
										</tr>
										<tr>
											<td class="titel">Properheid, Hygi&euml;ne: </td>
											<td>
											<input type="hidden" name="ProperheidReason" value="" />
											<input type="radio" name="Properheid" value="slecht" class="radio" /></td>
											<td><input type="radio" name="Properheid" value="minder" class="radio" /></td>
											<td><input type="radio" name="Properheid" value="OK" class="radio" /></td>
											<td><input type="radio" name="Properheid" value="goed" class="radio" /></td>
											<td class="noborder"><input type="radio" name="Properheid" value="perfect" class="radio" /></td>
										</tr>
										<tr>
											<td class="titel">Muziek: </td>
											<td>
											<input type="hidden" name="MuziekReason" value="" />
	                                        <input type="radio" name="Muziek" value="slecht" class="radio" /></td>
											<td><input type="radio" name="Muziek" value="minder" class="radio" /></td>
											<td><input type="radio" name="Muziek" value="OK" class="radio" /></td>
											<td><input type="radio" name="Muziek" value="goed" class="radio" /></td>
											<td class="noborder"><input type="radio" name="Muziek" value="perfect" class="radio" /></td>
										</tr>
										<tr>
											<td class="titel">Kwaliteit van de maaltijd: </td>
											<td>
											<input type="hidden" name="KwaliteitReason" value="" />
	                                        <input type="radio" name="Kwaliteit" value="slecht" class="radio" /></td>
											<td><input type="radio" name="Kwaliteit" value="minder" class="radio" /></td>
											<td><input type="radio" name="Kwaliteit" value="OK" class="radio" /></td>
											<td><input type="radio" name="Kwaliteit" value="goed" class="radio" /></td>
											<td class="noborder"><input type="radio" name="Kwaliteit" value="perfect" class="radio" /></td>
										</tr>
										<tr>
											<td class="titel">Kwantiteit van de maaltijd: </td>
											<td>
											<input type="hidden" name="KwantiteitReason" value="" />
	                                        <input type="radio" name="Kwantiteit" value="slecht" class="radio" /></td>
											<td><input type="radio" name="Kwantiteit" value="minder" class="radio" /></td>
											<td><input type="radio" name="Kwantiteit" value="OK" class="radio" /></td>
											<td><input type="radio" name="Kwantiteit" value="goed" class="radio" /></td>
											<td class="noborder"><input type="radio" name="Kwantiteit" value="perfect" class="radio" /></td>
										</tr>
										<tr>
											<td class="titel">Keuze op de wijnkaart: </td>
											<td>
											<input type="hidden" name="wijnkaartReason" value="" />
	                                        <input type="radio" name="wijnkaart" value="slecht" class="radio" /></td>
											<td><input type="radio" name="wijnkaart" value="minder" class="radio" /></td>
											<td><input type="radio" name="wijnkaart" value="OK" class="radio" /></td>
											<td><input type="radio" name="wijnkaart" value="goed" class="radio" /></td>
											<td class="noborder"><input type="radio" name="wijnkaart" value="perfect" class="radio" /></td>

											
										</tr>
                                        <tr>
											<td class="titel">Zal u nog terugkomen? </td>
											<td>
											<input type="hidden" name="terugkomenReason" value="" />
	                                        <input type="radio" name="terugkomen" value="slecht" class="radio" /> Nee</td>
											<td><input type="radio" name="terugkomen" value="ja" class="radio" /> Ja</td>
										</tr>
										<tr>
											<td colspan="6" class="noborder"><input type="submit" class="Inputbox" name="versturen" value="Verstuur Enqu&ecirc;te" /></td>
										</tr>
									</table>
								</li>
							</ol>
							</form>
						</div>
					</td>
					<td id="RightSide">
						<img src="images/HomePagePhoto-1012-3.jpg" width="234" height="157" alt="Het Kompas foto 1" /><br /><br />
						<img src="images/HomePagePhoto-1012-2.jpg" width="234" height="157" alt="Het Kompas foto 2" /><br /><br />
						<img src="images/HomePagePhoto-1012.jpg" width="234" height="157" alt="Het Kompas foto 3" />
					</td>
				</tr>
			</table>
		</div>
	</div>
	<div id="Footer">&nbsp;</div>
	<div id="FooterContent">
		<? FooterContent (); ?>
	</div>
</div>
<? GoogleAnal (); ?>
</body>
</html>

<?php
function form_controle()
{

$naam = ($_POST['naam']);
$telnr = ($_POST['telnr']);
$datum = ($_POST['datum']);
$uur = ($_POST['uur']);
$email = ($_POST['email']);
$waar = ($_POST['waarkentu']);
$stoorden = ($_POST['stoorden']);
$suggesties = ($_POST['suggesties']);
$Onthaal = ($_POST['Onthaal']);
$OnthaalReason = ($_POST['OnthaalReason']);
$Bediening = ($_POST['Bediening']);
$BedieningReason = ($_POST['BedieningReason']);
$Sfeer = ($_POST['Sfeer']);
$SfeerReason = ($_POST['SfeerReason']);
$Properheid = ($_POST['Properheid']);
$ProperheidReason = ($_POST['ProperheidReason']);
$Muziek = ($_POST['Muziek']);
$MuziekReason = ($_POST['MuziekReason']);
$Kwaliteit = ($_POST['Kwaliteit']);
$KwaliteitReason = ($_POST['KwaliteitReason']);
$Kwantiteit = ($_POST['Kwantiteit']);
$KwantiteitReason = ($_POST['KwantiteitReason']);
$wijnkaart = ($_POST['wijnkaart']);
$wijnkaartReason = ($_POST['wijnkaartReason']);
$terugkomen = ($_POST['terugkomen']);
$terugkomenReason = ($_POST['terugkomenReason']);



		
// Nu stuur ik een email om te zeggen dat er iemand bijgekomen is voor de mailing.

//$to = "info@hetkompas.be";
$to = "info@westdesign.be"; 

$subject = "Enquete via Website";

$body = stripslashes ("
<html><title>Contact</title>
<body bgcolor=\"#FFFFFF\" text=\"#000000\">
<font size=\"-1\" face=\"Verdana, Arial, Helvetica, sans-serif\">

<strong>Bezoek: $datum om $uur.</strong><br /><br />
<strong>Naam:</strong> $naam<br />
<strong>Tel:</strong> $telnr<br />
<strong>E-mail:</strong> $email<br /><br />
<strong>Ik heb Het Kompas leren kennen via:</strong> $waar<br />
<strong>Waren er zaken die u stoorden tijdens uw aanwezigheid?</strong><br />
$stoorden<br /><br />
<strong>Hebt u suggesties voor ons?</strong><br />
$suggesties
<br /><br />
<strong>Punten volgens de klant:</strong><br />
Onthaal: $Onthaal ( $OnthaalReason )<br />
Bediening: $Bediening ( $BedieningReason )<br />
Sfeer: $Sfeer ( $SfeerReason ) <br />
Properheid: $Properheid ( $ProperheidReason )<br />
Muziek: $Muziek ( $MuziekReason )<br />
Kwaliteit: $Kwaliteit ( $KwaliteitReason )<br />
Kwantiteit: $Kwantiteit ( $KwantiteitReason )<br />
Wijnkaart: $wijnkaart ( $wijnkaartReason )<br />
Komt u nog terug?: $terugkomen ($terugkomenReason)<br />
");

$headers ='X-Mailer: PHP/' . phpversion() . "\n";
$headers .= 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n";
$headers .= 'From: '.$email.''."\r\n";

mail($to, $subject, $body, $headers,'-finfo@hetkompas.be'); 

header("Location:enquete_test.php?s=ok");

}
?>