Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Notice przy odpalaniu strony
szokmen
post 22.05.2010, 14:10:23
Post #1





Grupa: Zarejestrowani
Postów: 30
Pomógł: 0
Dołączył: 19.05.2010

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


Witam,
mam taki kawałek kodu jak poniżej i jest jeden malutki problem jak wpisuje w przeglądarce adres strony to wszystko się wyświetla tak jak trzeba wszystko działa tylko wyskakuje mi tez taki niechciany notice:
Notice: Undefined index: wybor in G:\wamp\www\formularz.php on line 33
i nie bardzo wiem o co chodzi.

  1. echo '<div id="h0">';
  2. echo '<form action= "formularz.php" method="get">';
  3. echo '<input type ="hidden" name="wybor" value="szukaj">';
  4. echo '<input type= "text" name="napis">';
  5. echo '<input type= "submit" value="Szukaj imie">';
  6. echo '</form>';
  7. echo '</div>';
  8.  
  9. echo '<div id="h3">';
  10. echo '<form action= "formularz.php" method="get">';
  11. echo '<input type ="hidden" name="wybor" value="DEL">';
  12. echo '<input type= "hidden" name="id">';
  13. echo '</form>';
  14. echo '</div>';
  15.  
  16. if(isset($_POST["wybor"])== 'dodaj')
  17. {
  18. $imie1=$_POST['imie'];
  19. $nazwisko1=$_POST['nazwisko'];
  20. $nazwa1=$_POST['nazwa_firmy'];
  21. $telefon1=$_POST['telefon'];
  22.  
  23.  
  24. if($imie1 and $nazwisko1 and $nazwa1 and $telefon1)
  25. {
  26.  
  27. $ins =mysql_query("insert into klienci set imie='$imie1', nazwisko='$nazwisko1', nazwa_firmy='$nazwa1',telefon='$telefon1'");
  28. if($ins) echo "Rekord został dodany poprawnie";
  29. else echo "Błąd nie udało się dodać nowego rekordu";
  30. }
  31. }
  32.  
  33. else if ($_GET["wybor"] == 'DEL')
  34. {
  35. $zapytanie3="DELETE from Klienci where id_klienta=$_GET[id];";
  36. $del = mysql_query($zapytanie3);
  37. if($del)
  38. {
  39. echo '<h5>rekord usuniety</h5>';
  40.  
  41. }
  42. else
  43. {
  44. echo '<h5>blad</h5>';
  45. mysql_query($del) or die('BŁĄD:'.mysql_error());
  46. }
  47. }
Go to the top of the page
+Quote Post

Posty w temacie


Closed TopicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 15.06.2025 - 11:24