Skorzystałem z poniższego skryptu PHP jak go zmodyfikować aby skrypt sprawdzał czy zostały zmienione domyśle pola value.
Jeżeli ich nie ma wszystko jest ok ale niestety musi tak zostać.
<?php { ////////// USTAWIENIA ////////// $email = 'e-mail'; // Adres e-mail adresata $subject = 'temat'; // Temat listu $message = 'Dziękujemy za wysłanie formularza'; // Komunikat $error = 'Wystąpił błąd podczas wysyłania formularza'; // Komunikat błędu $charset = 'utf-8'; // Strona kodowa ////////////////////////////// $head = "MIME-Version: 1.0\r\n" . "Content-Type: text/plain; charset=$charset\r\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" id="form"> <fieldset> <label> <input type="text" id="name" name="name" value="Imię i Nazwisko:" onBlur="if(this.value=='') this.value='Imię i Nazwisko:';" onFocus="if(this.value=='Imię i Nazwisko:') this.value='';"/> </label> <label> <input type="text" id="phone" name="phone" value="Telefon:" onBlur="if(this.value=='') this.value='Telefon:';" onFocus="if(this.value=='Telefon:') this.value='';"/> </label> <label> <input type="text" id="mail" name="email" value="E-mail:" onBlur="if(this.value=='') this.value='E-mail:';" onFocus="if(this.value=='E-mail:') this.value='';"/> </label> <input value="Wyczyść" class="button" name="reset" type="reset" /> <input value="Wyślij" class="button" name="submit" id="submit" type="submit" /> </fieldset> </form>
<?php } ?>