Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Sprawdzanie fomularza - wyrażenia reg PCRE
aleo
post
Post #1





Grupa: Zarejestrowani
Postów: 137
Pomógł: 0
Dołączył: 23.08.2008

Ostrzeżenie: (0%)
-----


  1. <form action="" method=get >
  2.  <input type="text" name="mail">
  3.  <input type="submit" value="send"></form>
  4.  
  5.  <?php
  6.  
  7.  
  8.  
  9.  if (isset($_GET['send'])) {
  10.      if ( preg_match("/w+@.w{2,4}/" . $_GET['send']=! 1 ) ) {
  11.          echo"dobrze" ;
  12.      }
  13.      else "zle";
  14.  }
  15.  
  16.  
  17.  ?>


Witam

Dlaczego powyższy fomularz nie działa ?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
aleo
post
Post #2





Grupa: Zarejestrowani
Postów: 137
Pomógł: 0
Dołączył: 23.08.2008

Ostrzeżenie: (0%)
-----


ok dzięki koledzy proszę jednak o jeszcze jedno wytłumaczenie kod
  1. <form action="" method=get >
  2.     <input type ="hidden" name="phon" value="1">
  3. <input type="text" name="mail">
  4. <input type="text" name="mail2">
  5. <input type="submit" value="send"
  6. name="send"></form>
  7.  
  8.  <?php
  9.  
  10.  
  11.  
  12.  
  13. if((preg_match("/^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,4}$/",$_GET['mail'] )) && (preg_match("/^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,4}$/",$_GET['mail2'] )) )
  14. {
  15. echo 'ok';
  16. }
  17. else echo 'nie<BR>';
  18. print_r($_GET);
  19.  ?>


Notice: Undefined index: mail in /home/desk/public_html/php/ke/listing_5/listing_5_5.php on line 24

Dlaczego wyskakuje ten błąd ? Przecież jest mail ?

Proszę o wytłumaczenie .
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: 14.10.2025 - 21:20