grejjen är att det funkar ibland och inbland inte!? vet inte varför..
skål för eventuell lösning :bire
<?
$error_msg = '<p id="fel_meddelande"><b> Du har inte fyllt i alla obligatoriska fält</b></p>';
$error = false;
$submit = $_POST['submit'];
if(empty($submit))
$form_sent = false;
else
$form_sent = true;
if ($form_sent)
{
$to = 'richardjohansson654@hotmail.com' . ', ';
$to .= 'richardjohansson654@hotmail.com' . ', ';
$to .= 'richardjohansson654@hotmail.com'. ', ';
$to .= 'richardjohansson654@hotmail.com';
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
if(!$name) { $error_msg .= '<p id="fel_meddelande_error"><i>• Du måste skriva ditt namn</i><br /></p>'; $error = true;}
if(!$email) { $error_msg .= '<p id="fel_meddelande_error"><i>• Du måste skriva din e-mail</i><br /></p>'; $error = true;}
if(!$subject) { $error_msg .= '<p id="fel_meddelande_error"><i>• Du måste skriva ett ämne</i><br /></p>'; $error = true;}
if(!$message) { $error_msg .= '<p id="fel_meddelande_error"><i>• Du måste skriva ett meddelande</i><br /></p>'; $error = true;}
if($email) { if(!eregi("^[a-z0-9_]+@[a-z0-9\-]+\.[a-z0-9\-\.]+$", $email)){ $error_msg .= "<p id=\"pprojin\"><i>• Felaktig E-postadress</i></p>"; $error = true; }}
if(!$error)
{
$msg = "Namn: \t $name \n";
$msg .= "E-mail: \t $email \n";
$msg .= "Meddelande: \n $message \n";
$mailheaders = "MIME-Version: 1.0\r\n";
$mailheaders .= "Content-type: text/plain; charset=iso-8859-1\r\n";
$mailheaders .= "From: $name <$email>\r\n";
$mailheaders .= "Reply-To: $name <$email>\r\n";
mail($to, $subject ,stripslashes($msg), $mailheaders);
}
}
if (($form_sent) && (!$error))
{
echo '<p id="about_motion_top">Tack för ditt mail ' . $name .'.</p>';
echo '<p id="about_motion_top">Ditt mail skickades utan problem och vi kommer att svara inom ett par dagar.</p>';
}
else
{
if ($error)
{
echo $error_msg;
}
?>
<form action="?sida=kontakta" method="post" name="contact">
<p id="kontakt_text">Namn:<SPAN class=rodpilar>*</span> <input name="name" type="text" value="<?php echo $name ?>" style="margin-left: 7px; height: 12px; width: 180px; border: 1px solid #000; background-color: #636363;color: #FFF; font-size: 9px;"></p>
<p id="kontakt_text">E-mail:<SPAN class=rodpilar>*</span> <input name="email" type="text" value="<?php echo $email ?>" style="margin-left: 3px; height: 12px; width: 180px; border: 1px solid #000; background-color: #636363;color: #FFF; font-size: 9px;"></p>
<p id="kontakt_text">Ämne:<SPAN class=rodpilar>*</span> <input name="subject" type="text" value="<?php echo $subject ?>" style="margin-left: 7px; height: 12px; width: 180px; border: 1px solid #000; background-color: #636363; color: #FFF; font-size: 9px;"></p>
<p id="kontakt_text">Meddelande<SPAN class=rodpilar>*</span>
<br />
<textarea name="message" cols="30" rows="8" style="margin-left: 0px; height: 100px; border: 1px solid #000; background-color: #636363; color: #FFF; font-size: 12px; font-family: verdana; width: 250px;"><?php echo $message ?></textarea></p>
<input name="submit" type="submit" value="Skicka" style="height: 17px; width: 60px; border: 1px solid #000; background-color: #636363; color: #000; font-size: 9px;">
<input name="submit" type="reset" value="Rensa" style="margin-left: 10px; height: 17px; width: 60px; border: 1px solid #000; background-color: #636363; color: #000; font-size: 9px;">
</form>
<?
}
?>