Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [php] podstawianie zmiennej, pod link
-Gość_andi_*-
post
Post #1





Goście







witam dry.gif mam male, glupie pytanie... jezeli otrzymuje z formularza dane tzn np. numer gg: 123456 i jest on przypisany pod zmienna $gadu to jak zrobic, aby podstawic ta zmienna do linka aby wyszedl link
echo '<A href="gg:'$gadu'">ble ble ble</A>'; (?) tzn "gg:123456" ( echo '<A href="gg:123456">ble ble ble</A>';
blinksmiley.gif pomocy
Go to the top of the page
+Quote Post
MrMag
post
Post #2





Grupa: Zarejestrowani
Postów: 154
Pomógł: 5
Dołączył: 24.02.2004

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


byles blisko

  1. <?php
  2. print "<a href='gg:$gg'>dsfsdf</a>";
  3. ?>


" - parsuje w poszukiwaniu zmiennych php
' - nie parsuje


--------------------
Go to the top of the page
+Quote Post
nospor
post
Post #3





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




http://pl.php.net/manual/pl/language.types.string.php
milej lektury smile.gif


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post
-Gość-
post
Post #4





Goście







kminie kminie czytam czytam ale cos nie dziala dalej:D
  1. <?php
  2. echo '<table border="1" width="490" cellspacing="0" cellpadding="0">
  3. <tr>
  4. <td colspan="2">'.$exp[0].'</td>
  5. <td width="199">
  6. <p align="right">'.$data.'</td>
  7. </tr>
  8. <tr>
  9. <td width="124">
  10. <p align="center">
  11. "<a href='gg:$gg'><img border="0" src="page/50/graffika/gadu.gif" width="32" height="32"></A>"
  12.  
  13. </td>
  14. </td>
  15. <td colspan="2">
  16. <p align="center">'.$exp[5].'</td>
  17. </tr>
  18. <tr>
  19. <td width="124"> </td>
  20. <td width="167"> </td>
  21. <td width="199">
  22. <p align="right">ip</td>
  23. </tr>
  24. </table>';
  25. ?>

gdzie jest blad?
Go to the top of the page
+Quote Post
NuLL
post
Post #5





Grupa: Zarejestrowani
Postów: 2 262
Pomógł: 21
Dołączył: 3.05.2004
Skąd: Sopot, Krakow, W-wa

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


  1. <table border="1" width="490" cellspacing="0" cellpadding="0">
  2. <tr>
  3. <td colspan="2"><?php echo $exp[0]; ?></td>
  4. <td width="199">
  5. <p align="right"><?php echo $data; ?></td>
  6. </tr>
  7. <tr>
  8. <td width="124">
  9. <p align="center">
  10. "<a href='gg:<?php echo $gg; ?>'><img border="0" src="page/50/graffika/gadu.gif" width="32" height="32"></A>"
  11.  
  12. </td>
  13. </td>
  14. <td colspan="2">
  15. <p align="center"><?php echo $exp[5]; ?></td>
  16. </tr>
  17. <tr>
  18. <td width="124"> </td>
  19. <td width="167"> </td>
  20. <td width="199">
  21. <p align="right">ip</td>
  22. </tr>
  23. </table>

Tak nie prosciej - nawet php sie mniej meczy winksmiley.jpg


--------------------
Javascript, Coffeescript, Node.js, Mongo, CouchDb, chmury, workery & inne bajery - zycie jest zbyt krotkie aby miec nudna prace :)
Go to the top of the page
+Quote Post
-Gość-
post
Post #6





Goście







moze i prosciej.. ale caly czas wywala blad "Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' ..." w tejj lini
  1. "<a href='gg:<?php echo $gg; ?>'><img border="0" src="page/50/graffika/gadu.gif" width="32" height="32"></A>"
Go to the top of the page
+Quote Post
erix
post
Post #7





Grupa: Moderatorzy
Postów: 15 467
Pomógł: 1451
Dołączył: 25.04.2005
Skąd: Szczebrzeszyn/Rzeszów




Cytat
expecting ',' or ';'

a gdzie sie srednik na koncu linijki podzial, hmm?


--------------------

ZCE :: Pisząc PW załączaj LINK DO TEMATU i TYLKO w sprawach moderacji :: jakiś błąd - a TREŚĆ BŁĘDU? :: nie ponaglaj z odpowiedzią via PW!
Go to the top of the page
+Quote Post
-Gość-
post
Post #8





Goście







dodalem srednik na koncu i teraz wywalilo: "Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in..." worriedsmiley.gif

  1. <table border="1" width="490" cellspacing="0" cellpadding="0">
  2. <tr>
  3. <td colspan="2"><?php echo $exp[0]; ?></td>
  4. <td width="199">
  5. <p align="right"><?php echo $data; ?></td>
  6. </tr>
  7. <tr>
  8. <td width="124">
  9. <p align="center">
  10. "<a href='gg:<?php echo $gg; ?>'><img border="0" src="page/50/graffika/gadu.gif" width="32" height="32"></A>";
  11.  
  12. </td>
  13. </td>
  14. <td colspan="2">
  15. <p align="center"><?php echo $exp[5]; ?></td>
  16. </tr>
  17. <tr>
  18. <td width="124"> </td>
  19. <td width="167"> </td>
  20. <td width="199">
  21. <p align="right">ip</td>
  22. </tr>
  23. </table>
Go to the top of the page
+Quote Post
nospor
post
Post #9





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




Ten kod co tu pokazales nie ma prawa wywalic parse errora.
Oto co jest mozliwe:

1) nie pokazales nam calego kodu
2) zapisujesz jeden plik a uruchamiasz inny bo myslisz ze to ten sam (nie raz tak bylo na forum winksmiley.jpg nie bierze tego do siebie)
3) plik masz na serwerze i robisz save lokalnie a myslisz ze na serwerze sie zmienia a sie nie zmienia (tez tak bywalo)

ps: a na przyszlosc prosze uzywac znacznikow w tytule zgodnie z zasadami forum przedszkole. poprawiam


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post
masel
post
Post #10





Grupa: Zarejestrowani
Postów: 13
Pomógł: 0
Dołączył: 24.05.2006

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


Ten kod działa.
W lini 10 dałeś "", nie wiem po co.

  1. <table border="1" width="490" cellspacing="0" cellpadding="0">
  2. <tr>
  3. <td colspan="2"><?php echo $exp[0]; ?></td>
  4. <td width="199">
  5. <p align="right"><?php echo $data; ?></td>
  6. </tr>
  7. <tr>
  8. <td width="124">
  9. <p align="center">
  10. <a href="gg:<?php echo $gg; ?>"><img border="0" src="boot.jpg" width="32" height="32"></A>;
  11.  
  12. </td>
  13. </td>
  14. <td colspan="2">
  15. <p align="center"><?php echo $exp[5]; ?></td>
  16. </tr>
  17. <tr>
  18. <td width="124"> </td>
  19. <td width="167"> </td>
  20. <td width="199">
  21. <p align="right">ip</td>
  22. </tr>
  23. </table>
Go to the top of the page
+Quote Post
-gosc-
post
Post #11





Goście







no wiec CALY kod pliku wyglada tak:

  1. <br>
  2. <?php
  3. /*********************************************
  4. * formularz
  5. *********************************************/
  6.  
  7. $pole1 = trim($_POST['pole1']);
  8. $pole2 = trim($_POST['pole2']);
  9. $pole3 = trim($_POST['pole3']);
  10. $pole4 = trim($_POST['pole4']);
  11. $data = date("H:i d.m.Y");
  12. $pole5 = trim($_POST['pole5']);
  13.  
  14. if(empty($pole1) and empty($pole2) and empty($pole5)) {
  15.  
  16. echo '<form action="" method="post">
  17. <input type="text" name="pole1" style="border: 0; width: 250px; height: 24px; background: url(page/50/graffika/ksiegaimie.gif)" />
  18. <input type="text" name="pole2" style="border: 0; width: 250px; height: 24px; background: url(page/50/graffika/ksiegaemail.gif)" /><br>
  19. <input type="text" name="pole3" style="border: 0; width: 250px; height: 24px; background: url(page/50/graffika/ksiegawww.gif)" />
  20. <input type="text" name="pole4" style="border: 0; width: 250px; height: 24px; background: url(page/50/graffika/ksiegagadu.gif)" /><br>
  21. <textarea name="pole5" style="border: 0; width: 500px; height: 48px; background: url(page/50/graffika/ksiegatresc.gif)">
  22. </textarea><br />
  23. <input type="submit" value="Dopisz sie!" /><br/>
  24. </form>';
  25.  
  26. }
  27. else {
  28.  
  29. $dane = $pole1."`".$pole2."`".$pole3."`".$pole4."`".$data."`".$pole5."n";
  30.  
  31. $file="baza.txt";
  32.  
  33. $fp=fopen("$file", "r+");
  34.  
  35. $dane=$dane.fread($fp, filesize($file));
  36.  
  37. rewind($fp);
  38.  
  39. flock($fp, 2);
  40.  
  41. fwrite($fp, $dane);
  42.  
  43. flock($fp, 3);
  44.  
  45. fclose($fp);
  46.  
  47. echo "Dziekuje za dodanie wpisu :)<br /><br><br>";
  48. }
  49.  
  50.  
  51. /*********************************************
  52. * podglad
  53. *********************************************/
  54.  
  55. $file = file("baza.txt");
  56. foreach($file as $value) {
  57. $exp = explode("`",$value);
  58. echo $exp[0]." ".$exp[1]." ".$exp[2]." ".$exp[3]." ".$exp[4]."<br />".$exp[5]."<hr />";
  59. } 
  60.  
  61. echo '<table border="1" width="490" cellspacing="0" cellpadding="0">
  62. <tr>
  63. <td colspan="2">'.$exp[0].'</td>
  64. <td width="199">
  65. <p align="right">'.$exp[4].'</td>
  66. </tr>
  67. <tr>
  68. <td width="124">
  69. <p align="center">
  70. <a href='gg:<?php echo $exp[3]; ?>'><img border="0" src="page/50/graffika/gadu.gif" width="32" height="32"></A>;
  71. </td>
  72. <td colspan="2">
  73. <p align="center">'.$exp[5].'</td>
  74. </tr>
  75. <tr>
  76. <td width="124">&nbsp;</td>
  77. <td width="167">&nbsp;</td>
  78. <td width="199">
  79. <p align="right">ip</td>
  80. </tr>
  81. </table>';
  82.  
  83. ?>


wywala caly czas:
"Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' ... no line 70"

nospor... punkt 2 i 3 odpada winksmiley.jpg
Go to the top of the page
+Quote Post
nospor
post
Post #12





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




a widzisz, nie zalapales idei jaka podal ci NuLL. On mial na mysli juz nie stosowanie echo:
  1. <?
  2. //jakis kod php
  3. $file = file("baza.txt");
  4. foreach($file as $value) {
  5. $exp = explode("`",$value);
  6. echo $exp[0]." ".$exp[1]." ".$exp[2]." ".$exp[3]." ".$exp[4]."<br />".$exp[5]."<hr />";
  7. } 
  8. ?>
  9. <table border="1" width="490" cellspacing="0" cellpadding="0">
  10. <tr>
  11. <td colspan="2">'.$exp[0].'</td>
  12. <td width="199">
  13. <p align="right">'.$exp[4].'</td>
  14. </tr>
  15. <tr>
  16. <td width="124">
  17. <p align="center">
  18. <a href='gg:<?php echo $exp[3]; ?>'><img border="0" src="page/50/graffika/gadu.gif" width="32" height="32"></A>;
  19. </td>
  20. <td colspan="2">
  21. <p align="center">'.$exp[5].'</td>
  22. </tr>
  23. <tr>
  24. <td width="124">&nbsp;</td>
  25. <td width="167">&nbsp;</td>
  26. <td width="199">
  27. <p align="right">ip</td>
  28. </tr>
  29. </table>
  30. <?
  31. //reszta kodu php
  32. ?>

pozatym jakbys luknal do linka co ci na poczatku dawalem to bys wiedzial ze twoja konstrukcja jest zla


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post
-Gość-
post
Post #13





Goście







tongue.gif dziekuje Wam wszysktim za pomoc smile.gif dziala smile.gif
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 Aktualny czas: 19.08.2025 - 17:00