PHP expert |
|
heb het contact form van tuinstoel aangepast, maar krijg error op regel 44
<?
ob_start();
$Admin = 'Ultimatum';
$Email = 'ultimatum22@hotmail.com';
$Subject = 'Request';
$Spam = 10;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Mail Formulier</title>
</head>
<body>
<?
if(!empty($_POST['submit']))
{
$error = '';
$I = 0;
if(empty($_POST['name'])) {
$error .= '-You have to fill in a name<br />'; $I++;
}elseif(empty($_POST['mail'])) {
$error .= '-You have to fill in an email address<br />'; $I++;
}elseif(empty($_POST['cmail'])) {
$error .= '-You have to confirm your email address<br />'; $I++;
}elseif(!preg_match("/^[A-Za-z0-9._\-]+\@[A-Za-z0-9._\-]+\.[A-Za-z]{2,4}$/", "$mail")) {
$error .= '-You have to fill in a valid email address<br />'; $I++;
}elseif($mail != $cmail) {
$error .= '-The email addresses you enterd are not the same<br />'; $I++;
}
if(!empty($error))
{
echo ($I == 1) ? 'The following error has occured:<br />' : 'The following errors has occured:<br />';
echo $error;
}
else
{
$Header = "MIME-Version: 1.0\r\n";
$Header .= "Content-type: text/html; charset=iso-8859-1\r\n";
$Header .= "To: ".$Admin." <".$Email.">\r\n";
$Header .= "From: ".$_POST['name']." <".$_POST['mail'].">\r\n";
$Message = 'Het volgende bericht is gestuurd via het contact formulier:<br /><hr><br />'$_POST['name'], $_POST['mail'], $_POST['colors'], $_POST['hexcolor'], $_POST['images'], $_POST['comment'];
mail($Email,$subject.,$Message,$Header);
echo 'De e-mail is succesvol verzonden!';
setcookie('mailform',1,time()+($spam*60));
$show = true;
}
}
$name = (isset($_POST['name'])) ? $_POST['name'] : '';
$mail = (isset($_POST['mail'])) ? $_POST['mail'] : '';
$color = (isset($_POST['color'])) ? $_POST['color'] : '';
$hexcolor = (isset($_POST['hexcolor'])) ? $_POST['hexcolor'] : '';
$images = (isset($_POST['images'])) ? $_POST['images'] : '';
$comment = (isset($_POST['comment'])) ? $_POST['comment'] : '';
if(isset($_COOKIE['mailform']))
{ $show = true; echo 'Je kunt maar eens in de '.$spam.' minuten een e-mail versturen!'; }
if(!isset($show))
{
?>
<br />
<form method="post">
Name:<br />
<input type="text" name="name" maxlength="250"><br />
Email:<br/>
<input type="text" name="mail" maxlength="350"><br />
Email [confirm]:<br />
<input type="text" name="cmail" maxlength="350"><br />
<br />
Color:<br />
<select name="color">
<option value="Choose Color" selected>Choose Color</option>
<option value="Black">Black</option>
<option value="White">White</option>
<option value="Green">Green</option>
<option value="Blue">Blue</option>
<option value="Purple">Purple</option>
<option value="Yellow">Yellow</option>
</select><br />
Hexcode:<br />
<input type="text" name="hexcode" maxlength="6"><br />
Images:<br />
<textarea name="images" cols="40" rows="5"></textarea><br />
Comments:<br />
<textarea name="comments" cols="40" rows="5"></textarea><br />
<input type="submit" value="submit" name="submit">
</form>
<br />
<?
}
?>
</body>
</html>
<? $Admin = 'Ultimatum'; $Email = 'ultimatum22@hotmail.com'; $Subject = 'Request'; $Spam = 10; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Mail Formulier</title> </head> <body> <? if(!empty($_POST['submit'])) { $error = ''; $I = 0; if(empty($_POST['name'])) { $error .= '-You have to fill in a name<br />'; $I++; }elseif(empty($_POST['mail'])) { $error .= '-You have to fill in an email address<br />'; $I++; }elseif(empty($_POST['cmail'])) { $error .= '-You have to confirm your email address<br />'; $I++; }elseif(!preg_match("/^[A-Za-z0-9._\-]+\@[A-Za-z0-9._\-]+\.[A-Za-z]{2,4}$/", "$mail")) { $error .= '-You have to fill in a valid email address<br />'; $I++; }elseif($mail != $cmail) { $error .= '-The email addresses you enterd are not the same<br />'; $I++; } { echo ($I == 1) ? 'The following error has occured:<br />' : 'The following errors has occured:<br />'; } else { $Header = "MIME-Version: 1.0\r\n"; $Header .= "Content-type: text/html; charset=iso-8859-1\r\n"; $Header .= "To: ".$Admin." <".$Email.">\r\n"; $Header .= "From: ".$_POST['name']." <".$_POST['mail'].">\r\n"; $Message = 'Het volgende bericht is gestuurd via het contact formulier:<br /><hr><br />'$_POST['name'], $_POST['mail'], $_POST['colors'], $_POST['hexcolor'], $_POST['images'], $_POST['comment']; mail($Email,$subject.,$Message,$Header); echo 'De e-mail is succesvol verzonden!'; $show = true; } } $name = (isset($_POST['name'])) ? $_POST['name'] : ''; $mail = (isset($_POST['mail'])) ? $_POST['mail'] : ''; $color = (isset($_POST['color'])) ? $_POST['color'] : ''; $hexcolor = (isset($_POST['hexcolor'])) ? $_POST['hexcolor'] : ''; $images = (isset($_POST['images'])) ? $_POST['images'] : ''; $comment = (isset($_POST['comment'])) ? $_POST['comment'] : ''; if(isset($_COOKIE['mailform'])) { $show = true; echo 'Je kunt maar eens in de '.$spam.' minuten een e-mail versturen!'; } { ?> <br /> <form method="post"> Name:<br /> <input type="text" name="name" maxlength="250"><br /> Email:<br/> <input type="text" name="mail" maxlength="350"><br /> Email [confirm]:<br /> <input type="text" name="cmail" maxlength="350"><br /> <br /> Color:<br /> <select name="color"> <option value="Choose Color" selected>Choose Color</option> <option value="Black">Black</option> <option value="White">White</option> <option value="Green">Green</option> <option value="Blue">Blue</option> <option value="Purple">Purple</option> <option value="Yellow">Yellow</option> </select><br /> Hexcode:<br /> <input type="text" name="hexcode" maxlength="6"><br /> Images:<br /> <textarea name="images" cols="40" rows="5"></textarea><br /> Comments:<br /> <textarea name="comments" cols="40" rows="5"></textarea><br /> <input type="submit" value="submit" name="submit"> </form> <br /> <? } ?> </body> </html>
|