Na swojej stronce mam form, który sprawdza czy wszystkie pola zostały wypełnione ale wysyłał mi krzaki. Szukałam i znalazłam taki który wysyła polskie znaki. No i tu są schody, bo umiem programować tylko w html i css a php dopiero się uczę.
Właśnie próbuje skompilować dwa formularze do wysyłania wiadomości. Jeden z nich pozwala na sprawdzanie czy pola formularza są wypełnione i na nim chciałam oprzeć swój formularz ponieważ wysyła mi wiadomość w ładniejszej formie.
<?php echo "<form method=\"post\" action=\"\"><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"> <tr> <td>Imię</td></tr> <tr><td><input type=\"text\" name=\"imie\" class=\"formfield large\"></td> </tr> <tr> <td>Nazwisko</td></tr> <tr><td><input type=\"text\" name=\"nazwisko\" class=\"formfield large\"></td> </tr> <tr> <td>Adres e-mail</td> </tr> <tr><td><input type=\"text\" name=\"email\" class=\"formfield large\"></td> </tr> <tr> <td>Telefon</td> </tr> <tr><td><input type=\"text\" name=\"telefon\" class=\"formfield large\"></td> </tr> <tr> <td>Treść wiadomości</td> </tr> <tr><td><textarea name=\"tresc\" class=\"formfield textarea\" rows=\"1\" cols=\"1\"></textarea></td> </tr> <tr> <td><input type=\"submit\" name=\"submit\" value=\"Wyślij\" class=\"submitbutton\"></td></tr> </table></form>"; } $message = "$_POST[imie]\n$_POST[nazwisko]\ne-mail: $_POST[email]\ntelefon: $_POST[telefon]\ntreść:$_POST[tresc]"; $header = "From: $_POST[imie] $_POST[nazwisko] <$_POST[email]>"; echo "<form method=\"post\" action=\"\"><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"> <tr> <td>Imię</td></tr> <tr><td><input type=\"text\" name=\"imie\" class=\"formfield large\"></td> </tr> <tr> <td>Nazwisko</td></tr> <tr><td><input type=\"text\" name=\"nazwisko\" class=\"formfield large\"></td> </tr> <tr> <td>Adres e-mail</td> </tr> <tr><td><input type=\"text\" name=\"email\" class=\"formfield large\"></td> </tr> <tr> <td>Telefon</td> </tr> <tr><td><input type=\"text\" name=\"telefon\" class=\"formfield large\"></td> </tr> <tr> <td>Treść wiadomości</td> </tr> <tr><td><textarea name=\"tresc\" class=\"formfield textarea\" rows=\"1\" cols=\"1\"></textarea></td> </tr> <tr> <td><input type=\"submit\" name=\"submit\" value=\"Wyślij\" class=\"submitbutton\"></td></tr> </table></form>"; } else echo "<span style=\"color: #FF0000; text-align: center;\">Wypełnij wszystkie pola formularza!</span>"; ?>
no i drugi, który niweluje krzaki.
[b]
<?php { ////////// USTAWIENIA ////////// $email = [email=""]'ko@c.com'[/email]; // Adres e-mail adresata $subject = 'Wiadomość ze strony www'; // Temat listu $message = 'Dziękujemy za wysłanie formularza'; // Komunikat $error = 'Wystąpił błąd podczas wysyłania formularza'; // Komunikat błędu $charset = 'iso-8859-2'; // Strona kodowa ////////////////////////////// $head = "MIME-Version: 1.0r\n" . "Content-Type: text/plain; charset=$charsetr\n" . "Content-Transfer-Encoding: 8bit"; $body = ''; foreach ($_POST as $name => $value) { { { } } } echo mail($email, "=?$charset?B?" . base64_encode($subject) . "?=", $body, $head) ? $message : $error; } else { ?> <form action="?" method="post"> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td>Imię</td></tr> <tr><td><input type="text" name="imie" class="formfield large"></td> </tr> <tr> <td>Nazwisko</td></tr> <tr><td><input type="text" name="nazwisko" class="formfield large"></td> </tr> <tr> <td>Adres e-mail</td> </tr> <tr><td><input type="text" name="email" class="formfield large"></td> </tr> <tr> <td>Telefon</td> </tr> <tr><td><input type="text" name="telefon" class="formfield large"></td> </tr> <tr> <td>Treść wiadomości</td> </tr> <tr><td><textarea name="tresc" class="formfield textarea" rows="1" cols="1"></textarea></td> </tr> <tr> <td><input type="submit" name="submit" value="Wyślij" class="submitbutton"></td></tr> </table> </form> <?php } ?>
z tego drugiego chciałam przenieść właśnie to co niweluje krzaki. Niestety dopiero uczę się PHP i do tej pory pisałam stronki w html i css. Czy mógłby mi ktoś pomóc w tej kompilacji. W który miejscu i co przenieść z drugiego skryptu do pierwszego. Będę bardzo wdzięczna za pomoc