20-06-2010, 01:42
Więc mam taki kod:
Jak zrobić, żeby to wysyłało email na adres: [email protected], chciałbym żeby po wysłaniu był napis "Wiadomość została wysłana, dziękuje" a po refreszu znowu był pusty formularz lub po kilku sekundach sam sie pokzaywal nowy. I może coś jeszcze co polecacie
Kod:
<?php
$status = $_POST['status'];
if ($status == 1){
$error = '';
if (empty($_POST['nazwa']))
$error .= '* Pole imię i nazwisko jest puste!<br />';
if (empty($_POST['email']))
$error .= '* Pole email jest puste!<br />';
if (empty($_POST['temat']))
$error .= '* Pole temat jest puste!<br />';
if (empty($_POST['wiadomosc']))
$error .= '* Pole wiadomosc jest puste!<br />';
}
if (($status == 0) || ($error)){
echo $error;
?>
<form action="" method="POST">
<div class="box">
<label>
<span><font face="Arial">Imię i Nazwisko :</font></span>
<input type="text" class="wpis" name="nazwa" id="nazwa" />
</label>
<label>
<span><font face="Arial">E-mail :</font></span>
<input type="text" class="wpis" name="email" id="email"/>
</label>
<label>
<span><font face="Arial">Temat :</font></span>
<input type="text" class="wpis" name="temat" id="temat"/>
</label>
<label>
<span><font face="Arial">Wiadomość :</font></span>
<textarea class="wiadomosc" name="wiadomosc" id="tresc"></textarea>
<input name="wyslij" class="button" type="submit" value="wyślij" />
<input type="hidden" name="status" value="1" />
</label>
</div>
</form>
<?php
}
if (($status == 1) && (!$error)){
$email = $_POST['email'];
$to = ''; // do kogo
$subject = $_POST['temat']; // temat
$message = $_POST['wiadomosc']; // treść wiadomości
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
// More headers
$headers .= "From: $email" . "\r\n"; // od kogo
$headers .= "Cc: $email" . "\r\n"; // kopia emaila
if (mail($to,$subject,$message,$headers))
echo 'Email został wysłany!';
}
?>
Jak zrobić, żeby to wysyłało email na adres: [email protected], chciałbym żeby po wysłaniu był napis "Wiadomość została wysłana, dziękuje" a po refreszu znowu był pusty formularz lub po kilku sekundach sam sie pokzaywal nowy. I może coś jeszcze co polecacie
