looks great
but i cant get it working
i always get two mails
My form looks like this
<form name="tstest4" action="formhandler_mutatie_eigen_medewerkers.php" method="post">
<input type="hidden" name="subject" value="Mutatie eigen medewerker">
<div id="hoursForm" style="display:none;"><b>
<p>BaanHOURS gegevens :</b>
<br><br>
<table>
<TR>
<TD>Saldo uren</TD>
<TD nowrap>
<INPUT size=35 name=saldo_uren>
</TD>
</TR>
<TR>
<TD>Saldo overuren</TD>
<TD><INPUT size=35 name=saldo_overuren></TD></TR>
<TR>
<TD>Saldo meeruren</TD>
<TD><INPUT size=35 name=saldo_meeruren></TD></TR>
<TR>
<TD>Saldo verlofuren </TD>
<TD nowrap><INPUT size=35 name=saldo_verlofuren></TD></TR>
</table>
</p>
</div><div id="fmForm" style="position:relative;display:none;"><b>
<p>FM gegevens :</b><br><br>
<table>
<TR>
<TD>Wpf <br>(aanwezigheid): </TD>
<TD><INPUT size=35 name=wpf></TD>
</TR>
<TR>
<TD>Postadres:</TD>
<TD><INPUT size=35 name=postadres></TD>
</TR>
<TR>
<TD>Titel (nieuw):</TD>
<TD><INPUT size=35 name=titel_nieuw></TD>
</TR>
<TR>
<TD>Mobielnummer:</TD>
<TD><INPUT size=35 name=mobielnummer></TD>
</TR>
<tr>
<td><br><strong>
Extra autorisatie<br> toegangspas </strong><br>
</td>
<td></td>
</tr>
<tr>
<td>Pasnummer :</td>
<td><input size="35" name="pasnummer"></td>
</tr>
<tr>
<td>Speciale ruimten:</td>
<td><input size="35" name="speciale_ruimten"></td>
</tr>
<tr>
<td>24 uurs <br>autorisatie:</td>
<td><input type="checkbox" name="vierentwintig_uurs_autorisatie" value="Ja"></td>
</tr>
<tr>
<td>Zijdeuren <br>invaliden:</td>
<td><input type="checkbox" name="zijdeuren_invaliden" value="Ja"></td>
</tr>
<tr>
<td>Parkeergarage:</td>
<td><input type="checkbox" name="parkeergarage" value="Ja"></td>
</tr>
<tr>
<td><p align="left">Kenteken auto:</td>
<td><input size="35" name="kenteken_auto"></td>
</tr>
<tr>
<td><p align="left">Van:</td>
<td><input size="35" name="van"></td>
</tr>
<tr>
<td><p align="left">Tot:</td>
<td><input size="35" name="tot"></td>
</tr>
<tr>
<td>Reden:</td>
<td><textarea rows="2" name="reden" cols="27"></textarea></td>
</tr>
</table>
</p>
</div>
<div id="divButtons" name="divButtons">
<dd><table border="0" width="5%">
<tr>
<td width="50%" nowrap><input type="button" value="Print" onclick="printPage()"></td>
<td width="50%" nowrap><input type="submit" value="Versturen" id="sub"
style="display:none;"></td>
</tr>
</table>
</dd>
</div>
</td>
</form>
</div>
</body>
</html>
My formhandler code is
<?php
include("includes/login.php");
@extract($_POST);
$name = stripslashes($name);
$subject = stripslashes($subject);
$headers = "From: $row[0] \n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html";
$messagepo = stripslashes
("
<p align=\"center\"><font size=\"4\">Mutatie eigen medewerker PO</font></p>
<center>
<table border=\"0\" width=\"53\">
<tr>
<td width=\"50%\" nowrap bgcolor=\"#C0C0C0\">Mutatiedatum</td>
<td width=\"50%\"> $mutatiedatum</td>
</tr>
<tr>
<td width=\"50%\" nowrap bgcolor=\"#C0C0C0\">Straat</td>
<td width=\"50%\"> $straat</td>
</tr>
<tr>
<td width=\"50%\" nowrap bgcolor=\"#C0C0C0\">Huisnummer</td>
<td width=\"50%\"> $huisnummer</td>
</tr>
<tr>
<td width=\"50%\" nowrap bgcolor=\"#C0C0C0\">Toevoeging</td>
<td width=\"50%\"> $toevoeging</td>
</tr>
<tr>
<td width=\"50%\" nowrap bgcolor=\"#C0C0C0\">Postcode</td>
<td width=\"50%\"> $postcode</td>
</tr>
<tr>
<td width=\"50%\" nowrap bgcolor=\"#C0C0C0\">Woonplaats</td>
<td width=\"50%\"> $woonplaats</td>
</tr>
<tr>
<td width=\"50%\" nowrap bgcolor=\"#C0C0C0\">Telefoonnummer</td>
<td width=\"50%\"> $telefoonnummer</td>
</tr>
<tr>
<td width=\"50%\" nowrap bgcolor=\"#C0C0C0\">Ingangsdatum Scheiding</td>
<td width=\"50%\"> $ingangsdatum</td>
</tr>
<tr>
<td width=\"50%\" nowrap bgcolor=\"#C0C0C0\">Naam medewerker wijzigt</td>
<td width=\"50%\">$naam_medewerker_wijzigt_scheiding</td>
</tr>
<tr>
<td width=\"50%\" nowrap bgcolor=\"#C0C0C0\">Zo ja naam wordt (Scheiding)</td>
<td width=\"50%\"> $zo_ja_naam_wordt_scheiding </td>
</tr>
<tr>
<td width=\"50%\" nowrap bgcolor=\"#C0C0C0\">Geboortedatum partner</td>
<td width=\"50%\"> $geboortedatum_partner</td>
</tr>
<tr>
<td width=\"50%\" nowrap bgcolor=\"#C0C0C0\">Geboorteplaats partner</td>
<td width=\"50%\"> $geboorteplaats_partner</td>
</tr>
<tr>
<td width=\"50%\" nowrap bgcolor=\"#C0C0C0\">Geslacht partner</td>
<td width=\"50%\"> $geslacht_partner</td>
</tr>
<tr>
<td width=\"50%\" nowrap bgcolor=\"#C0C0C0\">Naam partner</td>
<td width=\"50%\"> $naam_partner</td>
</tr>
<tr>
<td width=\"50%\" nowrap bgcolor=\"#C0C0C0\">Naam medewerker wijzigt</td>
<td width=\"50%\"> $naam_medewerker_wijzigt_huwelijk</td>
</tr>
<tr>
<td width=\"50%\" nowrap bgcolor=\"#C0C0C0\">Zo ja naam wordt (Huwelijk)</td>
<td width=\"50%\"> $zo_ja_naam_wordt_huwelijk </td>
</tr>
<tr>
<td width=\"50%\" nowrap bgcolor=\"#C0C0C0\">Geboortedatum</td>
<td width=\"50%\"> $geboortedatum</td>
</tr>
<tr>
<td width=\"50%\" nowrap bgcolor=\"#C0C0C0\">Voornaam kind</td>
<td width=\"50%\"> $voornaam_kind</td>
</tr>
<tr>
<td width=\"50%\" nowrap bgcolor=\"#C0C0C0\">Achternaam kind</td>
<td width=\"50%\"> $achternaam_kind</td>
</tr>
<tr>
<td width=\"50%\" nowrap bgcolor=\"#C0C0C0\">Subcodering kostenplaats</td>
<td width=\"50%\"> $subcodering</td>
</tr>
<tr>
<td width=\"50%\" nowrap bgcolor=\"#C0C0C0\">Kostencomponent</td>
<td width=\"50%\"> $kostencomponent</td>
</tr>
<tr>
<td width=\"50%\" nowrap bgcolor=\"#C0C0C0\">Functietype</td>
<td width=\"50%\"> $functietype</td>
</tr>
<tr>
<td width=\"50%\" nowrap bgcolor=\"#C0C0C0\">Invoergroep</td>
<td width=\"50%\"> $invoergroep</td>
</tr>
<tr>
<td width=\"50%\" nowrap bgcolor=\"#C0C0C0\">Saldo uren</td>
<td width=\"50%\"> $saldo_uren</td>
</tr>
<tr>
<td width=\"50%\" nowrap bgcolor=\"#C0C0C0\">Saldo overuren</td>
<td width=\"50%\"> $saldo_overuren</td>
</tr>
<tr>
<td width=\"50%\" nowrap bgcolor=\"#C0C0C0\">Saldo meeruren</td>
<td width=\"50%\"> $saldo_meeruren</td>
</tr>
<tr>
<td width=\"50%\" nowrap bgcolor=\"#C0C0C0\">Saldo verlofuren</td>
<td width=\"50%\"> $saldo_verlofuren</td>
</tr>
<tr>
<td width=\"50%\" nowrap bgcolor=\"#C0C0C0\">Saldo ADV uren</td>
<td width=\"50%\"> $saldo_adv_uren</td>
</tr>
<tr>
<td width=\"50%\" nowrap bgcolor=\"#C0C0C0\">Saldo bijwerken</td>
<td width=\"50%\"> $saldo_bijwerken</td>
</tr>
</table>
</center>
");
$messagefm = stripslashes
("
<p align=\"center\"><font size=\"4\">Mutatie eigen medewerker FM</font></p>
<center><table border=\"0\" width=\"312\">
<tr>
<td bgcolor=\"#C0C0C0\" width=\"50%\">Titel (Nieuw)</td>
<td width=\"50%\">$titel_nieuw</td>
</tr>
<tr>
<td bgcolor=\"#C0C0C0\" width=\"50%\">Kenteken auto</td>
<td width=\"50%\">$kenteken_auto</td>
</tr>
<tr>
<td bgcolor=\"#C0C0C0\" width=\"50%\">Van</td>
<td width=\"50%\">$van</td>
</tr>
<tr>
<td bgcolor=\"#C0C0C0\" width=\"50%\">Tot</td>
<td width=\"50%\">$tot</td>
</tr>
<tr>
<td bgcolor=\"#C0C0C0\" width=\"50%\">Reden</td>
<td width=\"50%\">$reden</td>
</tr>
</table>
</center>
");
$email1 = true;
$email2 = true;
foreach ($_POST['$titel_nieuw,$reden,$tot,$van,$kenteken_auto'] as $value)
{
if (!$value)
{$email1 = false; break;}
}
foreach ($_POST['$saldo_uren,$saldo_overuren,$saldo_meeruren,$saldo_verlofuren'] as $value)
{
if (!$value)
{$email2 = false; break;}
}
if ($email1)
{
$mail = mail('jderksen@hr.nl', $subject, $messagefm, $headers);
if ($mail) {echo 'email1 send OK<br>';}
else {echo 'email1 send FAIL<br>';}
}
if ($email2)
{
$mail = mail('jderksen@hr.nl', $subject, $messagepo, $headers);
if ($mail) {echo 'email2 send OK<br>';}
else {echo 'email2 send FAIL<br>';}
}
?>