Nieuw lid |
|
Hallo allemaal,
Ik ben bezig met het bouwen van een php contact formulier, nou is mijn kennis niet erg groot.
Ik heb al bij diverse tutorials gekeken maar het lukt me maar niet de mailtjes die in ontvang te stylen met wat simpele html.
Hieronder is mijn code te zien die ervoor moet zorgen dat mijn inkomende mailtjes er allemaal wat schappelijker uitzien.
Wanneer ik nu iets in mijn inbox krijg is dit met de html head en body tags, hij leest dit dus niet als html.
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$from = 'From: info@epicconcepts.nl';
$to = 'info@epicconcepts.nl';
$subject = 'Contact formulier bericht';
$human = $_POST['human'];
$headers = "From: " . strip_tags($_POST['req-email']) . "\r\n";
$headers .= "Reply-To: ". strip_tags($_POST['req-email']) . "\r\n";
$headers .= "CC: quincynorbert@live.nl\r\n";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$message = '<!DOCTYPE html><html><head><style type="text/css">
body{background: #EDEBEA;}
#naam{background:#222222;border:4px solid #DDD;width:650px;}
#mail{background:#222222;border:4px solid #DDD;width:650px;}
#message{background:#222222;border:4px solid #DDD;width:650px;}</style></head>
<body>
<div id="naam">'.$name.'</div>
<div id="mail">'.$email.'</div>
<div id="message">'.$message.'</div>
</body>
</html>';
if ($_POST['submit'])
{
if ($name != '' && $email != '')
{
if ($human == '4')
{
if (mail ($to, $subject, $message, $from))
{
echo '<p class="correct-message">Your message has been sent!</p>';
}
else
{
echo '<p class="correct-message">Something went wrong, go back and try again!</p>';
}
}
else if ($_POST['submit'] && $human != '4')
{
echo '<p class="correct-message">You answered the anti-spam question incorrectly!</p>';
}
}
else
{
echo '<p class="correct-message">You need to fill in all required fields!</p>';
}
}
?>
<?php $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $from = 'From: info@epicconcepts.nl'; $to = 'info@epicconcepts.nl'; $subject = 'Contact formulier bericht'; $human = $_POST['human']; $headers = "From: " . strip_tags($_POST['req-email']) . "\r\n"; $headers .= "Reply-To: ". strip_tags($_POST['req-email']) . "\r\n"; $headers .= "CC: quincynorbert@live.nl\r\n"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $message = '<!DOCTYPE html><html><head><style type="text/css"> body{background: #EDEBEA;} #naam{background:#222222;border:4px solid #DDD;width:650px;} #mail{background:#222222;border:4px solid #DDD;width:650px;} #message{background:#222222;border:4px solid #DDD;width:650px;}</style></head> <body> <div id="naam">'.$name.'</div> <div id="mail">'.$email.'</div> <div id="message">'.$message.'</div> </body> </html>'; if ($_POST['submit']) { if ($name != '' && $email != '') { if ($human == '4') { if (mail ($to, $subject, $message, $from)) { echo '<p class="correct-message">Your message has been sent!</p>'; } else { echo '<p class="correct-message">Something went wrong, go back and try again!</p>'; } } else if ($_POST['submit'] && $human != '4') { echo '<p class="correct-message">You answered the anti-spam question incorrectly!</p>'; } } else { echo '<p class="correct-message">You need to fill in all required fields!</p>'; } } ?>
Ik hoop dat iemand me kan helpen
Met vriendelijke groet,
Quincy
titjes schreef: Volgende keer codetags gebruiken! Puntje "2e" in de forumregels
|