Nieuw lid |
|
Het contact script wil niet versturen, ik heb geen idee waarom niet.
Iemand een idee?
// Html Contact script
<table width="68%" border="0" cellspacing="8" id="contenttable">
<form id="form" action="gocontact.php" method="post">
<tr>
<td width="150" class="gamelist-txtwhite">Email Address: </td>
<td><input type="contact" name="email" id="email"/></td>
</tr>
<tr>
<td class="gamelist-txtwhite">Subject: </td>
<td><input type="contact" name="subject" id="subject"/></td>
</tr>
<tr>
<td valign="top" class="gamelist-txtwhite">Message:</td>
<td class="gamelist-txtwhite"><textarea name="message" id="textarea" cols="50" rows="6"></textarea></td>
</tr>
<tr>
<td height="21" valign="top" class="gamelist-txtwhite">
<input type="reset" name="reset" id="reset" value="Reset" />
</td>
<td class="gamelist-txtwhite"><input type="submit" name="send" id="send" value="Send" /></td>
</tr>
</form>
</table>
// Html Contact script <table width="68%" border="0" cellspacing="8" id="contenttable"> <form id="form" action="gocontact.php" method="post"> <td width="150" class="gamelist-txtwhite">Email Address: </td> <td><input type="contact" name="email" id="email"/></td> <td class="gamelist-txtwhite">Subject: </td> <td><input type="contact" name="subject" id="subject"/></td> <td valign="top" class="gamelist-txtwhite">Message: </td> <td class="gamelist-txtwhite"><textarea name="message" id="textarea" cols="50" rows="6"></textarea></td> <td height="21" valign="top" class="gamelist-txtwhite"> <input type="reset" name="reset" id="reset" value="Reset" /> <td class="gamelist-txtwhite"><input type="submit" name="send" id="send" value="Send" /></td>
// Php gocontact script
<?php
ob_start();
function isValidEmail($email){
return eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email);
}
if (isset($_POST['email']) and $_POST['email']!="" and !isValidEmail($_POST['email'])) {
echo "Fill in a valid Email Address!";
header("Refresh: 3; URL=contact.html"); //het e-mail formulier
exit();
}
// configureren van de gegevens
$to = "email@email.com";
$subject = $_POST['subject'] ;
$bericht = $_POST['message'] ;
$header = "From: " . $_POST['email'] . " <" . $_POST['email'] . ">\n";
$header .= "Reply-To: " . $_POST['email'] . " <" . $_POST['email'] . ">\n";
$header .= "X-Priority: 1";
//een array 'faults' maken
$faults = array();
if (isset($_POST['button'])) // als je op verzenden klikt
{
if (empty($_POST['subject'])) // het veld subject moet ingvult zijn
{
$fouten [] = "* You need to fill in the subject!";
}
if (empty($_POST['email'])) // het veld email moet ingevult zijn
{
$fouten [] = "* You need to fill in a valid Email Address!";
}
if (empty($_POST['message'])) // het veld message moet ingevult zijn
{
$fouten [] = "* You need to fill in a message!";
}
if (count($fouten)==0) // als er 0 fouten zijn moet die het verzenden
{
mail ($to, $subject, $bericht, $header);
header("location: index.php"); //bewerk dit stukje naar een pagina die je zelf wilt.
exit;
}
else{
echo "<u>Couldn't send the message, because of the next error(s):</u> ";
foreach($fouten as $fout)
echo "<br />" . $fout;
echo "<br /><br />";
}
}
?>
// Php gocontact script <?php function isValidEmail($email){ return eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email); } if (isset($_POST['email']) and $_POST['email']!="" and !isValidEmail ($_POST['email'])) { echo "Fill in a valid Email Address!"; header("Refresh: 3; URL=contact.html"); //het e-mail formulier } // configureren van de gegevens $to = "email@email.com"; $subject = $_POST['subject'] ; $bericht = $_POST['message'] ; $header = "From: " . $_POST['email'] . " <" . $_POST['email'] . ">\n"; $header .= "Reply-To: " . $_POST['email'] . " <" . $_POST['email'] . ">\n"; $header .= "X-Priority: 1"; //een array 'faults' maken if (isset($_POST['button'])) // als je op verzenden klikt { if (empty($_POST['subject'])) // het veld subject moet ingvult zijn { $fouten [] = "* You need to fill in the subject!"; } if (empty($_POST['email'])) // het veld email moet ingevult zijn { $fouten [] = "* You need to fill in a valid Email Address!"; } if (empty($_POST['message'])) // het veld message moet ingevult zijn { $fouten [] = "* You need to fill in a message!"; } if (count($fouten)==0) // als er 0 fouten zijn moet die het verzenden { mail ($to, $subject, $bericht, $header); header("location: index.php"); //bewerk dit stukje naar een pagina die je zelf wilt. } else{ echo "<u>Couldn't send the message, because of the next error(s):</u> "; foreach($fouten as $fout) } } ?>
|