15-09-2011, 03:21
ok już podaje kod php
Kod:
<?php
// sprawdzamy, czy zmienna $submit jest pusta
if (empty($_POST['submit'])) {
// wyświetlamy formularz
echo "<table border=\"0\">
<form action=\"kontakt.php\" target=\"I1\" method=\"post\">
<tr class=\"tresc\">
<td align=\"right\">
<p style=\"margin-right: 10\">Imię:</td>
<td><input type=\"text\" name=\"imie\" \"width: 250px\" size=20 class=\"trescb\" style=\"float: left\"></td>
</tr>
<tr class=\"tresc\">
<td align=\"right\">
<p style=\"margin-right: 10\">Nazwisko:</td>
<td><input type=\"text\" name=\"nazwisko\" \"width: 250px\" size=20 class=\"trescb\" style=\"float: left\"></td>
</tr>
<tr class=\"tresc\">
<td align=\"right\">
<p style=\"margin-right: 10\">Adres:</td>
<td><input type=\"text\" name=\"adres\" \"width: 250px\" size=20 class=\"trescb\" style=\"float: left\"></td>
</tr>
<tr class=\"tresc\">
<td align=\"right\">
<p style=\"margin-right: 10\">Kod pocztowy:</td>
<td><input type=\"text\" name=\"kod\" \"width: 250px\" size=20 class=\"trescb\" style=\"float: left\"></td>
</tr>
<tr class=\"tresc\">
<td align=\"right\">
<p style=\"margin-right: 10\">Miejscowosć:</td>
<td><input type=\"text\" name=\"miejscowosc\" \"width: 250px\" size=20 class=\"trescb\" style=\"float: left\"></td>
</tr>
<tr class=\"tresc\">
<td align=\"right\">
<p style=\"margin-right: 10\">Data urodzenia:</td>
<td><input type=\"text\" name=\"data\" \"width: 250px\" size=20 class=\"trescb\" style=\"float: left\"></td>
</tr>
<tr class=\"tresc\">
<td align=\"right\">
<p style=\"margin-right: 10\">Telefon:</td>
<td><input type=\"text\" name=\"telefon\" \"width: 250px\" size=20 class=\"trescb\" style=\"float: left\"></td>
</tr>
<tr class=\"tresc\">
<td align=\"right\">
<p style=\"margin-right: 10\">E-mail:</td>
<td><input type=\"text\" name=\"email\" \"width: 250px\" size=20 class=\"trescb\" style=\"float: left\"></td>
</tr>
<tr class=\"tresc\">
<td align=\"right\">
<p style=\"margin-right: 10\">Pole wyboru:</td>
<td><select name=\"wyb\" class=\"trescb\" style=\"float: left\">
<option>grafika</option>
<option>ksiegowosc</option>
</select></td>
</tr>
<tr class=\"tresc\">
<td> </td>
<td> <input type=\"checkbox\" name=\"zgoda\" class=\"trescb\" size=\"20\">
Wyrażam zgodę na gromadzenie, przechowywanie i przetwarzanie moich
danych osobowych<br><Br> </td></tr>
<tr class=\"trescb\">
<td> </td>
<td><input type=\"submit\" name=\"submit\" value=\"Wyslij\" size=\"20\" action=\"kontakt.php\" rel=\"flowerdivcontainer\" rev=\"flowernote,flowernote2\">
<input type=\"reset\" value=\"Wyczysć\" size=\"20\"></td></form>
</tr>
</table>";
}
// sprawdzamy, czy zmienne przesłane z formularza nie są puste
elseif (!empty($_POST['imie']) && !empty($_POST['nazwisko']) && !empty($_POST['wyb']) && !empty($_POST['zgoda']) && !empty($_POST['kod']) && !empty($_POST['email']) && !empty($_POST['miejscowosc']) && !empty($_POST['data']) && !empty($_POST['telefon']) && !empty($_POST['adres'])) {
// jeżeli powyższy warunek jest spełniony tworzona jest wiadomość
// zmienna $message zawiera treść wiadomości
$message = "
Imie: $_POST[imie]\n
Nazwisko: $_POST[nazwisko]\n
Adres: $_POST[adres]\n
Kod: $_POST[kod]\n
Miejscowosc: $_POST[miejscowosc]\n
Data: $_POST[data]\n
Telefon: $_POST[telefon]\n
E-mail: $_POST[email]\n
Pole wyboru: $_POST[wyb]";
// zmienna $header zawiera przede wszystkim adres zwrotny
$header = "From: $_POST[imie] <$_POST[email]>";
// funkcja mail() za pomocą której wiadomość zostanie wysłana
@mail("[email protected]","Wiadomosc ze strony WWW","$message","$header")
or die('Nie udało się wysłać wiadomości');
// wyświetlenie komunikatu w przypadku powodzenia
echo "<body bgcolor=\"#FFFFE0\"><div align=\"center\"><strong>Wiadomość została wysłana poprawnie!<br>W ciągu kilku dni od wysłania formularza otrzymasz na podany przez Ciebie adres e-mail
potwierdzenie zgłoszenia. </p></strong></div>";
}
// lub w przypadku nie wypełnienia formularza do końca
else echo "<body bgcolor=\"#FFFFE0\"> <span \"color: #FF0000; text-align: center;\"><br><br>Wypełnij wszystkie pola formularza!</span>";
?>
<p align="center">
<iframe name="I1" src="no.php" width="623" height="200" noResize border=0 noresize="noresize" frameborder="0" marginwidth="0" marginheight="0" scrolling="no">
</iframe></p>