Ik heb dit bestand include in index.php. Het verstuurt de mail niet en ik krijg de echo niet te zien. Als ik niet uncludede weergeef dan doet ie het wel.
script index.php:
<!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>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<table width="100%" border="0">
<tr>
<td width="20%"> </td>
<td width="60%"><?php
include ('menu.php');
?>
</td>
<td width="20%"> </td>
</tr>
<tr>
<td> </td>
<td><?php
switch (strtolower($_GET['page']))
{
case "tutorial":
include("tutorial.php");
break;
case "gastenboek":
include("gastenboek.php");
break;
case "scripts":
include("scripts.php");
break;
default:
include("default.php");
break;
}
?>
</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html>
script mailform (scripts.php)
<!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>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body><?
function checkmail($mail)
{
$email_host = explode("@", $mail);
$email_host = $email_host['1'];
$email_resolved = gethostbyname($email_host);
if ($email_resolved != $email_host && eregi("^[0-9a-z]([-_.~]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,4}$",$mail))
$valid = 1;
return $valid;
}
// geef e-mail adres op van ontvanger
$mail_ontv = "
[email protected]";
// als er niet op submit is gedrukt, of als er wel op is gedrukt maar niet alles ingevoerd is
if (!$_POST['submit'] || $_POST['submit'] && (!$_POST['naam'] || !$_POST['mail'] || !checkmail($_POST['mail']) || !$_POST['msggs'] || !$_POST['onderwerp']))
{
if ($_POST['submit'] && (!$_POST['naam'] || !$_POST['mail'] || !checkmail($_POST['mail']) || !$_POST['msggs'] || !$_POST['onderwerp']))
{
echo "Je bent je naam, e-mail adres, onderwerp of bericht vergeten in te vullen. Ook kan het zijn ";
echo "dat je een verkeerd e-mail adres hebt ingevuld.<p>";
}
// form + tabel
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
echo "<form method=\"POST\" ACTION=\"" . $_SERVER['PHP_SELF'] . "\">";
// naam
echo "<tr><td>Naam:</td></tr>";
echo "<tr><td><input type=\"text\" name=\"naam\" value=\"" . $_POST['naam'] . "\"></td></tr>";
// space
echo "<tr><td> </td></tr>";
// mail
echo "<tr><td>E-mail adres:</td></tr>";
echo "<tr><td><input type=\"text\" name=\"mail\" value=\"" . $_POST['mail'] . "\"></td></tr>";
// space
echo "<tr><td> </td></tr>";
// mail
echo "<tr><td>Onderwerp:</td></tr>";
echo "<tr><td><input type=\"text\" name=\"onderwerp\" value=\"" . $_POST['onderwerp'] . "\"></td></tr>";
// space
echo "<tr><td> </td></tr>";
// mail
echo "<tr><td>Bericht:</td></tr>";
echo "<tr><td><TEXTAREA name=\"msggs\" ROWS=\"6\" COLS=\"45\">" . htmlentities($_POST['msggs']) . "</TEXTAREA></td></tr>";
// space
echo "<tr><td> </td></tr>";
// button
echo "<tr><td> </td></tr>";
echo "<tr><td><input type=\"submit\" name=\"submit\" value=\"Versturen\"></td></tr>";
// sluit form + tabel
echo "</form>";
echo "</table>";
}
// versturen naar
else
{
// set datum
$datum = date("d.m.Y H:i");
// set ip
$ip = $_SERVER['REMOTE_ADDR'];
$inhoud_mail = "===================================================\n";
$inhoud_mail .= "INGEVULD CONTACT formULIER\n";
$inhoud_mail .= "===================================================\n\n";
$inhoud_mail .= "Naam: " . $_POST['naam'] . "\n";
$inhoud_mail .= "E-mail adres: " . $_POST['mail'] . "\n";
$inhoud_mail .= "Bericht:\n";
$inhoud_mail .= $_POST['msggs'] . "\n\n";
$inhoud_mail .= "Verstuurd op $datum via het ip " . $ip . "\n\n";
$inhoud_mail .= "===================================================\n\n";
$headers = "From: " . $_POST['naam'] . " <" . $_POST['mail'] . ">";
mail($mail_ontv, $_POST['onderwerp'], $inhoud_mail, $headers);
echo "Bedankt voor het versturen van een e-mail. Je zult snel een antwoord ";
echo "krijgen indien dit nodig is.<p>";
echo "We nemen alles serieus en zullen vertrouwelijk omgaan met de informatie ";
echo "die we binnen krijgen. Je e-mail adres zal nooit aan derden worden gegeven.";
}
?>
</body>
</html>