Mam problem, nad ktorym siedze już chyba 3 godzine i już zgłupiałem. Może mi ktoś pomóc? Ja z phpa nie jestem zbyt mocny, no ale przynajmniej próbowałem coś wykombinować...
Mam sobie formularz kontaktowy, taki o:
Kod: Zaznacz cały
div class="w_1a">
<div class="box_txt2"><p id="loadBar" style="display:none;">
<strong>Trwa wysyłanie wiadomości. Zaczekaj chwilkę…</strong>
<img src="form-kontakt/loading.gif" alt="Wysyłanie..." title="Sending Email" />
</p>
<p id="emailSuccess" style="display:none;">
<strong style="color:green;">Ok! Twój Email został wysłany.</strong>
</p>
<div id="contactFormArea">
<form action="form-kontakt/contact.php" method="post" id="cForm">
<fieldset>
<label for="posName">Imię:</label>
<input class="text" type="text" size="25" name="posName" id="posName" />
<label for="posEmail">Email:</label>
<input class="text" type="text" size="25" name="posEmail" id="posEmail" />
<label for="posRegard">W sprawie:</label>
<input class="text" type="text" size="25" name="posRegard" id="posRegard" />
<label for="posText">Wiadomość:</label>
<textarea cols="50" rows="5" name="posText" id="posText"></textarea>
<label for="posText2">Wiadomość2:</label>
<textarea cols="50" rows="5" name="posText2" id="posText2"></textarea>
<label for="posText3">Wiadomość3:</label>
<textarea cols="50" rows="5" name="posText3" id="posText3"></textarea>
<label>
<input class="submit" type="submit" name="sendContactEmail" id="sendContactEmail" value=" Wyślij wiadomość " />
</label>
</fieldset>
</form></div>
</div>
Do tego mam plik php:
Kod: Zaznacz cały
<?php
include "config.php";
// No need to edit below unless you really want to. It's using a simple php mail() function. Use your own if you want
function cleanPosUrl ($str) {
return stripslashes($str);
}
if ( isset($_POST['sendContactEmail']) )
{
$to = $yourEmail;
$subject = $yourSubject.': '.$_POST['posRegard'];
$message = cleanPosUrl($_POST['posText']).' '.cleanPosUrl($_POST['posText2']).' '.cleanPosUrl($_POST['posText3']);
$headers = "From: ".cleanPosUrl($_POST['posName'])." <".$_POST['posEmail'].">\r\n";
$headers .= 'To: '.$yourName.' <'.$yourEmail.'>'."\r\n";
$mailit = mail($to,$subject,$message,$headers);
if ( @$mailit ) {
header('Location: '.$referringPage.'?success=true');
}
else {
header('Location: '.$referringPage.'?error=true');
}
}
?>
Pozdrawiam