oorafalekoo
08-12-2012, 12:50
mam wstawiony formularz kontaktowy ale nie działa coś mi znalazłem go w tutorialu w internecie proszę o pomoc.
kod html
<form action="http://brukteam.olka.mydevil.net/form.php" method="post"> <input id="imie" style="width: 300px;" onblur="if(this.value=='') this.value='Imie i Nazwisko';" type="text" name="imie" value="Imie i Nazwisko" /> <label for="mail"></label> <br /><input id="mail" style="width: 300px;" onblur="if(this.value=='') this.value='Adres e-mail';" type="text" name="mail" value="Adres e-mail" /> <label for="temat"></label><br /><input id="temat" style="width: 300px;" onblur="if(this.value=='') this.value='Tytuł wiadomosci';" type="text" name="temat" value="Tytuł wiadomosci" /> <label for="wiadomosc"></label><textarea id="wiadomosc" style="width: 300px; font-family: Arial;" rows="10">Treść Wiadomości</textarea></form> <input id="send" type="image" name="send" value="wyslij" src="images/wyslij.png" />
<?php
$imie = htmlspecialchars (trim ($_POST['imie'])); $mail = htmlspecialchars (trim ($_POST['mail']));$temat = htmlspecialchars (trim ($_POST['temat']));$wiadomosc = htmlspecialchars (trim ($_POST['wiadomosc']));$send = $_POST['send'];
$odbiorca = "raf.janczyk@gmail.com";
$header = "Content-type: text/html; charset=utf-8\r\nFrom: $mail";
if (isset($_COOKIE['send'])) $error ='Odczekaj '.($_COOKIE['send']-time ()).' sekund przed wysłaniem kolejnej wiadomości';
if ($send && !isset($_COOKIE['send'])) { if (empty($imie)) { $error = "Nie wypełniłeś pola <strong>Nick !</strong><br/>"; } elseif (strlen ($imie) > 20) { $error .="Za długi nick - max. 20 znaków <br/>";} if (empty($mail)) { $error .= "Nie wypełniłeś pola <strong>E-mail !</strong><br/>"; } elseif (strlen ($mail) > 30) { $error .="Za długi e-mail - max. 30 znaków <br/>";} elseif (preg_match ('/^[a-zA-ZąćęłńóśźżĄĆĘŁŃÓŚŹŻ0-9\-\_\.]+\@[a-zA-ZąćęłńóśźżĄĆĘŁŃÓŚŹŻ0-9\-\_\.]+\.[a-z]{2,4}$/',$mail) == false) { $error .= "Niepoprawny adres E-mail! <br/>"; } if (empty($temat)) { $error .= "Nie wypełniłeś pola <strong>Temat !</strong><br/>"; } elseif (strlen ($temat) > 120) { $error .="Za długi temat - max. 120 znaków <br/>";} if (empty($wiadomosc)) { $error .= "Nie wypełniłeś pola <strong>Wiadomość !</strong><br/>"; } elseif (strlen ($wiadomosc) > 400) { $error .="Za długa wiadomość - max. 400 znaków <br/>";}
if (empty($error)) { $list = "Przysłał - $imie ($mail) <br/> Treść wiadomości - $wiadomosc"; if (mail ($odbiorca, $temat, $list, $header)) { $error .= "Twoja wiadomość została wysłana"; setcookie ("send", time ()+60, time ()+60); } else { $error .= "Wystąpił błąd podczas wysyłania wiadomości, spróbuj później.";} } }?>
Kod jest wstawiony w osobnym pliku ale powinno być ok a tu gwiazdki i inne tego typu zostaw na podwórko... nie reaguje na nic proszę o pomoc
kod html
<form action="http://brukteam.olka.mydevil.net/form.php" method="post"> <input id="imie" style="width: 300px;" onblur="if(this.value=='') this.value='Imie i Nazwisko';" type="text" name="imie" value="Imie i Nazwisko" /> <label for="mail"></label> <br /><input id="mail" style="width: 300px;" onblur="if(this.value=='') this.value='Adres e-mail';" type="text" name="mail" value="Adres e-mail" /> <label for="temat"></label><br /><input id="temat" style="width: 300px;" onblur="if(this.value=='') this.value='Tytuł wiadomosci';" type="text" name="temat" value="Tytuł wiadomosci" /> <label for="wiadomosc"></label><textarea id="wiadomosc" style="width: 300px; font-family: Arial;" rows="10">Treść Wiadomości</textarea></form> <input id="send" type="image" name="send" value="wyslij" src="images/wyslij.png" />
<?php
$imie = htmlspecialchars (trim ($_POST['imie'])); $mail = htmlspecialchars (trim ($_POST['mail']));$temat = htmlspecialchars (trim ($_POST['temat']));$wiadomosc = htmlspecialchars (trim ($_POST['wiadomosc']));$send = $_POST['send'];
$odbiorca = "raf.janczyk@gmail.com";
$header = "Content-type: text/html; charset=utf-8\r\nFrom: $mail";
if (isset($_COOKIE['send'])) $error ='Odczekaj '.($_COOKIE['send']-time ()).' sekund przed wysłaniem kolejnej wiadomości';
if ($send && !isset($_COOKIE['send'])) { if (empty($imie)) { $error = "Nie wypełniłeś pola <strong>Nick !</strong><br/>"; } elseif (strlen ($imie) > 20) { $error .="Za długi nick - max. 20 znaków <br/>";} if (empty($mail)) { $error .= "Nie wypełniłeś pola <strong>E-mail !</strong><br/>"; } elseif (strlen ($mail) > 30) { $error .="Za długi e-mail - max. 30 znaków <br/>";} elseif (preg_match ('/^[a-zA-ZąćęłńóśźżĄĆĘŁŃÓŚŹŻ0-9\-\_\.]+\@[a-zA-ZąćęłńóśźżĄĆĘŁŃÓŚŹŻ0-9\-\_\.]+\.[a-z]{2,4}$/',$mail) == false) { $error .= "Niepoprawny adres E-mail! <br/>"; } if (empty($temat)) { $error .= "Nie wypełniłeś pola <strong>Temat !</strong><br/>"; } elseif (strlen ($temat) > 120) { $error .="Za długi temat - max. 120 znaków <br/>";} if (empty($wiadomosc)) { $error .= "Nie wypełniłeś pola <strong>Wiadomość !</strong><br/>"; } elseif (strlen ($wiadomosc) > 400) { $error .="Za długa wiadomość - max. 400 znaków <br/>";}
if (empty($error)) { $list = "Przysłał - $imie ($mail) <br/> Treść wiadomości - $wiadomosc"; if (mail ($odbiorca, $temat, $list, $header)) { $error .= "Twoja wiadomość została wysłana"; setcookie ("send", time ()+60, time ()+60); } else { $error .= "Wystąpił błąd podczas wysyłania wiadomości, spróbuj później.";} } }?>
Kod jest wstawiony w osobnym pliku ale powinno być ok a tu gwiazdki i inne tego typu zostaw na podwórko... nie reaguje na nic proszę o pomoc