Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Closed TopicStart new topic
> blad
nbkadi
post
Post #1





Grupa: Zarejestrowani
Postów: 19
Pomógł: 0
Dołączył: 21.11.2004

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


witam server caly czas raportuje mi blad
Cytat
Parse error: parse error, unexpected T_ELSEIF in /home/users/nbkclan/public_html/articles.php on line 30


i mysle ze wszystko jest dobrze

  1. <html>
  2. <head>
  3. <title>Natural Born Kilazz A Polish Counter-Strike Clan | Articles</title>
  4. </head>
  5. <body>
  6. <?
  7.  
  8. if(isset ($format)):
  9. $file = fopen($article, &#092;"r\");
  10. $data = fread($file, 1000);
  11. fclose($file);
  12. $stripped_data = strip_tags($data);
  13. print(&#092;"<pre>$stripped_data</pre>\");
  14. elseif($format == &#092;"email\"):
  15. ?>
  16. <h2>Wyslij Artykul</h2>
  17. <form action=\"index.php?go=articles\" method=\"POST\">
  18. <p>Wyslij na adres e-mail: <input type=\"text\" name\"to\">
  19. <br>
  20. Twoj adres e-mail: <input type=\"text\" name=\"from\">
  21. <br>
  22. Krotki komentarz: <input type=\"text\" name=\"comment\">
  23. <input type=\"hidden\" name=\"article\" value=\"<? echo
  24. $article ?>\">
  25. <br>
  26. <input type=\"submit\" name=\"submit\" value=\"Wyslij!\">
  27. </form>
  28. <?
  29. endif;
  30. elseif(isset($submit)):
  31. $file = fopen($article, &#092;"r\");
  32. $data = fread($file, 1000);
  33. fclose($file);
  34. $stripped_data = strip_tags($data);
  35. $body = &#092;"Komentarz od nadawcy: \" . $comment . \"nn\" .
  36. $stripped_data;
  37. $subject = &#092;"Ten artykul powinien Cie zainteresowac!\";
  38. mail($to, $subject, $body, &#092;"FROM: $from\");
  39. ?>
  40. <h2>E-mail zostal wyslany ze strony NBK pomyslnie!</h2>
  41. <hr>
  42. <?
  43. print(&#092;"Do: $to<br>Od: $from<br>Temat:
  44. $subject<p><pre>$body</pre><hr>n&#092;";
  45. else:
  46. $file = fopen($article, &#092;"r\");
  47. $data = fread($file, 1000);
  48. fclose($file);
  49. print(&#092;"$data\");
  50. ?>
  51. <hr>
  52. <p>Sformatuj ten artykul do <a href=\"index.php?go=articles&go=article=<? echo $article ?>&format=print\">drukuj</a>!
  53. <br>
  54. <a href=\"index.php?go=articles&go=article=<? echo $article ?>&format=email\">wyslij</a> ten artykul znajomemu!
  55. <?
  56. endif;
  57.  
  58. ?>
  59. </body>
  60. </html>
Go to the top of the page
+Quote Post
Seth
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 2 335
Pomógł: 6
Dołączył: 7.03.2002

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


http://rtfm.killfile.pl/
http://www.leon.w-wa.pl/texts/kurs/syntax.php

Ten post edytował Seth 13.01.2005, 19:04:13
Go to the top of the page
+Quote Post
Wave
post
Post #3





Grupa: Zarejestrowani
Postów: 332
Pomógł: 6
Dołączył: 13.01.2005

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


To nie C#, tylko php. Składnia funkcji if wygląda trochę inaczej:
  1. <?php
  2.  
  3. if(warunek)
  4. {
  5. polecenie;
  6. }
  7. else if(warunek)
  8. {
  9. polecenie;
  10. }
  11. else
  12. {
  13. polecenie;
  14. }
  15.  
  16. ?>
Go to the top of the page
+Quote Post
nbkadi
post
Post #4





Grupa: Zarejestrowani
Postów: 19
Pomógł: 0
Dołączył: 21.11.2004

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


no stare przyzwyczajenia - ale powinno byc dobrze ?co tam moge zmienic ?
Go to the top of the page
+Quote Post
shima
post
Post #5





Grupa: Zarejestrowani
Postów: 245
Pomógł: 0
Dołączył: 9.09.2002

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


Cytat(Wave @ 2005-01-13 19:15:22)
To nie C#, tylko php. Składnia funkcji if wygląda trochę inaczej:
  1. <?php
  2.  
  3. if(warunek)
  4. {
  5. polecenie;
  6. }
  7. else if(warunek)
  8. {
  9. polecenie;
  10. }
  11. else
  12. {
  13. polecenie;
  14. }
  15.  
  16. ?>

Myśl lub sprawdzaj nim wyślesz. Poza tym popełniłeś podobny błąd.


--------------------
Nie ma nic stałego prócz zmiany...
Go to the top of the page
+Quote Post
Wave
post
Post #6





Grupa: Zarejestrowani
Postów: 332
Pomógł: 6
Dołączył: 13.01.2005

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


Cytat(shima @ 2005-01-13 19:18:09)
Myśl lub sprawdzaj nim wyślesz. Poza tym popełniłeś podobny błąd.

Niby jaki? Ja tam nie widze błędu, ale może coś przeoczyłem. :]
Cytat
no stare przyzwyczajenia - ale powinno byc dobrze ?co tam moge zmienic ?

Usuń endif i stosuj { oraz } zamiast :

Ten post edytował Wave 13.01.2005, 19:31:44
Go to the top of the page
+Quote Post
Seth
post
Post #7





Grupa: Przyjaciele php.pl
Postów: 2 335
Pomógł: 6
Dołączył: 7.03.2002

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


W C# akurat jest bardzo podbna skladnia laugh.gif

P.S. Moze by tak zaczac jednak od kursu php ?
Go to the top of the page
+Quote Post
Wave
post
Post #8





Grupa: Zarejestrowani
Postów: 332
Pomógł: 6
Dołączył: 13.01.2005

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


Hmm... Nawet nie wiedziałem o takiej składni alternatywnej. ;]
Go to the top of the page
+Quote Post
seaquest
post
Post #9





Grupa: Przyjaciele php.pl
Postów: 790
Pomógł: 7
Dołączył: 6.02.2003
Skąd: Polska

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


Temat zamykam ze względu na zły temat. Czekam na PW od autora z propozycją nowego tematu i oczywiście linkiem.


--------------------
Michał Płachta
Warsztat: Mac OS X Leopard, PostgreSQL, Text Mate, Retrospectiva + SVN
Go to the top of the page
+Quote Post

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

 



RSS Aktualny czas: 19.08.2025 - 07:47