Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP]Problem z wyslaniem formularza
Forum PHP.pl > Forum > Przedszkole
simon186
Witam.

Mam wydaje mi sie dosyc banalny problem z formularzem, nie chce sie wyslac na maila. Wydaje mi sie ze cos przeoczylem. Prosze o pomoc

Kod
<?


$wysylajacy = $_POST['wysylajacy'];
$odbiorca = "tresc <kontakt@tresc.eu>" . ", ";
$trescmaila = $_POST['trescmaila'];

mail($odbiorca, $trescmaila, $wysylajacy);

if(!isset($_GET['site'])) { echo'<div class="skontakt">Tresc...</div>
<form action="mailto:kontakt@tresc.eu" method="post" name="mail">
     <textarea name="trescmaila" cols="110" rows="6" class="logowanie1">'.$_POST['trescmaila'].'</textarea>

<div class="logowanie4">Adres e-mail:</div>
<div class="logowanie3"><input name="wysylajacy" type="text" size="113" class="logowanie" value="'.$_POST['wysylajacy'].'" /></div>

</form>
<input name="submit" type="submit" value="Wyślij" class="logowanie2"/>'; } ?>
MajareQ
Kod
    if (empty($_POST['submit'])) {
    // wyświetlamy formularz
    echo "
<table border=\"0\"><form method=\"post\">
<tr>
<td>Treść wiadomości</td>
<td><textarea name=\"tresc\" style=\"width: 250px; height: 100px\"></textarea></td>
</tr>
<tr>
<td>Imię, nazwisko lub nick</td>
<td><input type=\"text\" name=\"imie\" style=\"width: 250px\"></td>
</tr>
<tr>
<td>Adres e-mail</td>
<td><input type=\"text\" name=\"email\" style=\"width: 250px\"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type=\"submit\" name=\"submit\" value=\"Wyślij\">&nbsp;
<input type=\"reset\" value=\"Od nowa\"></td></form>
</tr>
</table>";
}
elseif (!empty($_POST['tresc']) && !empty($_POST['imie']) && !empty($_POST['email'])) {
    $trescmaila = $_POST['trescmaila'];
    $header = "From: $_POST['wysylajacy'] <$_POST['wysylajacy']>";
    @mail("twoj@email.pl","Tytul wiadomosci","$trescmaila","$header")
or die('Nie udało się wysłać wiadomości');
    // wyświetlenie komunikatu w przypadku powodzenia
    echo "<div align=\"center\"><strong>Wiadomość została wysłana poprawnie!</strong></div>";
}
else echo "<span style=\"color: #FF0000; text-align: center;\">Wypełnij wszystkie pola formularza!</span>";
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.