Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Zmienna w odnośniku - nie działa
InzaghiX
post 11.12.2011, 18:25:11
Post #1





Grupa: Zarejestrowani
Postów: 24
Pomógł: 0
Dołączył: 20.01.2008

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


Witam, chcę aby po wybraniu danego linka wyświetlał się dany komunikat z instrukcji switch natomiast tak się nie dzieje tylko ładuje się błąd zamiast wyboru ... Gdzie zrobiłem błąd?

  1. <?php
  2. echo "<div ><a href=".$id=A.">GRUPA A</a></div>";
  3. echo "<div ><a href=".$id=C. ">GRUPA B</a></div>";
  4. echo "<div ><a href=".$id=D.">GRUPA C</a></div>";
  5. echo "<div ><a href=".$id=E. ">GRUPA D</a></div>";
  6. echo "</div>";
  7.  
  8. echo" <div class='news_box'>";
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15. $litera = $_GET['id'];
  16. switch($litera)
  17. {
  18. case "A": { print("#00FF00");break; }
  19. case "B": { print("#0000FF");break; }
  20. case "C": { print("#FF0000");break; }
  21. default: { print("Nie znaleziono podanego koloru");break; }
  22. }
  23.  
  24. ?>
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 3)
gargamel
post 11.12.2011, 19:11:49
Post #2





Grupa: Zarejestrowani
Postów: 278
Pomógł: 35
Dołączył: 25.06.2010

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


Podstawy się kłaniają smile.gif
  1. echo "<div ><a href='?id=A'>GRUPA A</a></div>";
Go to the top of the page
+Quote Post
InzaghiX
post 11.12.2011, 20:57:15
Post #3





Grupa: Zarejestrowani
Postów: 24
Pomógł: 0
Dołączył: 20.01.2008

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


Nadal nic nie działa....


Przy czym chciałbym zaznaczyć że moja struktura strony wygląda tak .,,
  1. /config
  2. /banner.php
  3. /footer.php
  4. /head.php
  5. /header.php
  6. /images
  7. /menu
  8. /page
  9. /content.php
  10. /group.php
  11. /upload


a plik index następująco...

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <?php
  3.  
  4.  
  5. include_once('config/head.php');
  6. include_once('config/header.php');
  7. include_once('config/banner.php');
  8. include_once('menu/menu.php');
  9.  
  10.  
  11. echo"<div id='templatmeo_wrapper'>";
  12.  
  13. echo"<div id='templatemo_content_wrapper'>";
  14.  
  15. include_once('menu/sb_left.php');
  16.  
  17. if(empty($_GET['id']) or $_GET['id']=="content"){
  18. include("page/content.php");
  19. }
  20. else {
  21.  
  22. if($_GET['id']=="content"){
  23. include("page/content.php");
  24. }
  25.  
  26. if($_GET['id']=="timetable"){
  27. include("page/timetable.php");
  28. }
  29.  
  30. if($_GET['id']=="group"){
  31. include("page/group.php");
  32. }
  33.  
  34.  
  35. }
  36.  
  37. include ('menu/sb_right.php'); ?>
  38.  
  39. <div class="cleaner"></div>
  40.  
  41. </div>
  42.  
  43. </div>
  44.  
  45. <?php include('config/footer.php'); ?>


Ten post edytował InzaghiX 11.12.2011, 21:01:27
Go to the top of the page
+Quote Post
gargamel
post 11.12.2011, 22:21:22
Post #4





Grupa: Zarejestrowani
Postów: 278
Pomógł: 35
Dołączył: 25.06.2010

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


Co znaczy nic nie działa?
Napisz jaki dostajesz błąd i pokaż co zrobiłeś z tego pierwszego kodu.
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: 14.08.2025 - 06:45