Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [php]Problem z funkcja switch, Problem z funkcja switch i opcja default
-Emek-
post 6.10.2007, 14:50:55
Post #1





Goście







Witam.

Mam sobie stronke w ktorej używam funkcje switch. Gdy wywołam artykol "lol" pokazuje mi sie artykol "lol" oraz napis pod tym z fucnkcji "menu" default: Nie ma takiej strony. A gdy wywolam art z "menu" np: newsy to robi mi sie pod tym napis "aaa_text" z funkcji "aaa" default. Chciałbym żeby w jakis prosty sposób zdefiniowac default dla calej strony a opcje switch dla menu i aaa zostały ponieważ chce miec linki index.php?menu=reklama i /index.php?a=omg. Prosze wiec o pomoc.

  1. <?
  2.  
  3. $menu = $_GET['menu'];
  4.  
  5. switch($menu){
  6.  
  7. case reklama:
  8. include 'arty_menu/reklama.inc';
  9. break;
  10.  
  11. case newsy:
  12. include 'arty_menu/newsy.inc';
  13. break;
  14.  
  15. default:
  16. echo 'Nie ma takiej strony';
  17. break;
  18.  
  19. }
  20. ?>
  21.  
  22. <?
  23.  
  24. $aaa = $_GET['aaa'];
  25.  
  26. switch($aaa){
  27.  
  28. case lol:
  29. include 'aaa/lol.inc';
  30. break;
  31.  
  32. case omg:
  33. include 'aaa/omg.inc';
  34. break;
  35.  
  36. default:
  37. echo 'aaa_text';
  38. break;
  39.  
  40. }
  41.  
  42. ?>
Powód edycji: dodalem tag (cysiaczek)
Go to the top of the page
+Quote Post
kossa
post 6.10.2007, 15:13:08
Post #2





Grupa: Zarejestrowani
Postów: 1 165
Pomógł: 9
Dołączył: 9.04.2002
Skąd: Toruń

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


  1. <?php
  2. case "lol":
  3. ?>


i tak wszędzie - cudzysłów

Łukasz


--------------------
Go to the top of the page
+Quote Post
-Emek-
post 6.10.2007, 22:53:00
Post #3





Goście







Cytat(Emek @ 6.10.2007, 14:50:55 ) *
Chciałbym żeby w jakis prosty sposób zdefiniowac default dla calej strony a opcje switch dla menu i aaa zostały ponieważ chce miec linki index.php?menu=reklama i /index.php?a=omg. Prosze wiec o pomoc.
Go to the top of the page
+Quote Post

Reply to this 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: 31.07.2025 - 07:53