Witam,
Mam taki problem z formularzem, chciałbym żeby była w nim funkcja taka ze jak jakaś rubryka nie jest uzupełniona to żeby poniżej wyświetlał się komunikat np. „wypełnij wszystkie rubryki” z góry dzięki za pomoc.
<?php
if (count($_POST))
{
////////// USTAWIENIA //////////
$email = 'adziozone@op.pl'; // Adres e-mail adresata
$subject = ' kontakt'; // 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.0\r\n" .
"Content-Type: text/plain; charset=$charset\r\n" .
"Content-Transfer-Encoding: 8bit";
$body = '';
foreach ($_POST as $name => $value)
{
if (is_array($value))
{
for ($i = 0; $i < count($value); $i++)
{
$body .= "$name=" . (get_magic_quotes_gpc() ? stripslashes($value[$i]) : $value[$i]) . "\r\n";
}
}
else $body .= "$name=" . (get_magic_quotes_gpc() ? stripslashes($value) : $value) . "\r\n";
}
echo mail($email, "=?$charset?B?" . base64_encode($subject) . "?=", $body, $head) ? $message : $error;
}
else
{
?>
<form action="?" method="post">
<!-- Komentarz -->
<p align="right">
<b>
<font size="3" color="#ffffff">Imię i nazwisko:</font>
</b>
<font color="#000080">
<input maxLength="24" name="Imię i nazwisko:[]" size="30" style="font-weight: 700" value="<?= $imie; ?>" >
</font>
<br><br>
<b>
<font size="3" color="#ffffff">Adres e-mai:</font>
</b>
<font color="#000080">
<input maxLength="29" name="Adres -mail:[]" size="30" style="font-weight: 700" value="<?= $adres; ?>" >
<br>
</font>
<br>
<b>
<font size="3" color="#ffffff">Telefon:</font>
</b>
<font color="#000080">
<input maxLength="29" name="Telfon:[]" size="30" style="font-weight: 700" value="<?= $telefon; ?>">
<br>
</font>
<br>
</p>
<p align="right">
<b>
<font size="3" color="#ffffff">Treść:
</b>
</font>
<textarea rows="8" name="tresc[]" cols="40"></textarea> </p>
<br>
<center>
<input type="submit" name="wyslij" value="Wyślij" style="background-color: #000000; font-family: Verdana; color: #FFFFFF; font-size: 8pt; font-weight: bold; border: 1px solid #FFFFFF; ">
<input type="reset" name="reset" value="Wyczyść" style="background-color: #000000; font-family: Verdana; color: #FFFFFF; font-size: 8pt; font-weight: bold; border: 1px solid #FFFFFF; ">
</center>
<input type="hidden" name="location" value="dziekuje.htm">
</form>
<?php
}
?>