Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php][html] Poprawność emaila i zawartosci
Piotrwusek
post
Post #1





Grupa: Zarejestrowani
Postów: 399
Pomógł: 7
Dołączył: 11.06.2007
Skąd: Poznan

Ostrzeżenie: (20%)
X----


Mam taki kod do wysyłania maila który działa

ale potrzebuje żeby sprawdzał majla i czy wszystkie pola zostały wykorzystane

Oto skrypt

kontakt.php3
  1. <TABLE border=0 cellPadding=0 cellSpacing=0 width=564>
  2.  
  3. <TR>
  4. <td>
  5. <form action="email.php3" method="post">
  6. <table align="center" width="100%">
  7. <tr>
  8. <td align=right><font face="verdana,arial" size="1"><B>Imie:</td>
  9. <td><font face="verdana,arial" size="1"><input name="name" size=28 value=""></td>
  10. </tr>
  11. <tr>
  12. <td align=right><font face="verdana,arial" size="1"><B>E-Mail:</td>
  13. <td><font face="verdana,arial" size="1"><input name="email" size=28 value=""></td>
  14. </tr>
  15. <tr>
  16. <td align=right><font face="verdana,arial" size="1"><B>Temat:</td>
  17. <td><font face="verdana,arial" size="1"><input name="site_name" size=28 value=""></td>
  18. </tr>
  19. <tr>
  20. <td colspan=2><font face="verdana,arial" size="1"><B>Treść<BR><textarea name="Comments" cols=50 rows=8 wrap=soft></textarea></td>
  21. </tr>
  22. <tr>
  23. <td></td>
  24. <td><font face="verdana,arial" size="1"><input type="submit" value="Wyślij"></td>
  25. </tr>
  26. </form>
  27. </TD>
  28. </TR>


email.php3
  1. <?
  2.  
  3.  
  4.  
  5. $site_email = "email@coś.pl";
  6.  
  7.  
  8.  
  9.  
  10.  
  11. PRINT "<CENTER>";
  12. PRINT "Witaj, $name.";
  13. PRINT "<BR><BR>";
  14. PRINT "Dziekujemy za zainteresowanie się naszą stroną!<BR><BR>";
  15. PRINT "Twój e-mail został wysłany, odpowiedz przyjdzie niebawem.";
  16. PRINT "</CENTER>";
  17.  
  18. ?>
  19.  
  20. <?
  21. mail("$email", "Thank You From $site_name!", "$namen
  22. Thank you $name for submitting your question/comments!
  23. We will handle your submission in the order of arrival.
  24. If needed, we will email you back. If you do not receive
  25. a reply within 48 hours, please email $site_email!");
  26.  
  27. mail("$site_email",
  28. "$site_name",
  29. "Napisał: $name
  30. Email: $email
  31. Treść:
  32. $Comments
  33. ");
  34. ?>


Pomożecie

Ten post edytował Piotrwusek 22.06.2007, 11:11:11
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Sadu2
post
Post #2





Grupa: Zarejestrowani
Postów: 229
Pomógł: 13
Dołączył: 31.05.2007

Ostrzeżenie: (10%)
X----


Witam,
Żeby nie zaczynać kolejnego nowego wątku to napisze tutaj, bo w sumie o to samo chodzi.
Mam taki kod:

  1. <?php
  2. function sprawdz_email($email) {
  3. if(!preg_match('/^[a-z0-9.-_]+@[a-z0-9-_]+.([a-z0-9-_]+.)*?[a-z]+$/is', $email)) {
  4. return false;
  5. }
  6. else {
  7. return true;
  8. }
  9. }
  10. ?>


I gdzie go mam wsadzić w ten formularz:

  1. <div class="naglowek">
  2. <div class="menug2" align="center">
  3. Formularz Kontaktowy
  4. </div>
  5. </div>
  6. <div class="artykul">
  7. <img src="images/layout_11.gif" width="433" alt="" />
  8. <div class="archiwum5">
  9.  
  10. <!-- Formularz kontaktowy - contact.php -->
  11. <form ACTION="index.php?go=contact" method="post">
  12. <B>Imię:</B><BR> 
  13. <input TYPE="text" size="30" name="imie"><BR>
  14. <B>Twój adres e-mail:</B> <span class="required"><font color="red">*</FONT></span><BR> 
  15. <input TYPE="text" size="30" name="email"><BR>
  16. <B>Wybierz adresata:</B> <span class="required"><font color="red">*</FONT></span><BR>
  17. <select name="adresat">
  18. <option value="xx@xx.pl">Admin Strony</option>
  19. <option value="yy@yy.pl">Dyrektor Klubu</option>
  20. </SELECT><BR>
  21. <B>Temat:</B> <span class="required"><font color="red">*</FONT></span><BR> 
  22. <input TYPE="text" size="30" name="temat"><BR>
  23. <B>Treść:</B> <span class="required"><font color="red">*</FONT></span><BR> <textarea name="tresc" rows="7" cols="40"></TEXTAREA><BR>
  24. <input TYPE="submit" name"wyslij" value="Wyślij">
  25. <input type="reset" value="Wyczyść">
  26. </FORM>
  27.  
  28. <?
  29.  
  30. if (isset ($_POST['imie']) && ($_POST['email']) && ($_POST['adresat']) && ($_POST['temat']) && ($_POST['tresc'])) {
  31.  
  32. $wyslij = mail($adresat, $temat, 
  33. "E-mail zostal wyslany ze strony www
  34. ==================================================
  35. Tresc: 
  36.  
  37. $trescrn", 
  38. "From: $emailrnBounce-to: xxx@xxxx.pl");
  39.  
  40. if ($wyslij) {
  41.  
  42. echo "<P>Twój e-mail został wysłany!</P>";
  43.  
  44. } else {
  45.  
  46. echo "Przepraszamy, wystąpił problem z wysyłaniem. Proszę spróbować jeszcze raz";
  47. }
  48. }
  49. ?>
  50.  
  51. </div>
  52.  <img src="images/layout_22.gif" width="433" alt="" />
  53. </div>


Aby zadziała walidacja, jak ktoś wpisze w pole 'Twój email' np. adsdd
Pozdrawiam
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 30.12.2025 - 06:35