Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] Problem z $GET
MichallusTG
post
Post #1





Grupa: Zarejestrowani
Postów: 4
Pomógł: 0
Dołączył: 12.03.2007

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


Kod PHP:
  1. <?php
  2. if (array_key_exists('js', $_GET)) {
  3.  
  4. if ($_GET['js'] == 1) {
  5.  $x = 1;
  6.  $y = 2;
  7.  $z = 3;
  8. }
  9. else {
  10.  $x = 4;
  11.  $y = 5;
  12.  $z = 6;
  13. }
  14. }
  15. else {
  16.  $x = 1;
  17.  $y = 2;
  18.  $z = 3;
  19. }
  20.  
  21. }
  22. ?>


Kod strony:

  1. <title />
  2. </head>
  3. <?php print $x . $y . $z; ?>
  4. </body>
  5. </html>


W kodzie strony czysto. Pomógłby mi ktoś znaleźć błąd?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
mike
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 7 494
Pomógł: 302
Dołączył: 31.03.2004

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


To nie w tą stronę działa. Masz całkowicie źle.
Powinno być:

site.php
  1. <?php
  2.  
  3. if (array_key_exists('js', $_GET)) {
  4. if ($_GET['js'] == 1) {
  5. $x = 1;
  6. $y = 2;
  7. $z = 3;
  8. } else {
  9. $x = 4;
  10. $y = 5;
  11. $z = 6;
  12. }
  13. } else {
  14. $x = 1;
  15. $y = 2;
  16. $z = 3;
  17. }
  18.  
  19. ?>


index.php
  1. <?php
  2.  
  3. include('site.php');
  4.  
  5. ?>
  6. <html> 
  7. <head>
  8. <title />
  9. </head>
  10. <body>
  11. <?php print $x . $y . $z; ?>
  12. </body>
  13. </html>
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: 8.10.2025 - 07:36