Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php/js] problem z wstawieniem do zmiennej
mefjiu
post
Post #1





Grupa: Zarejestrowani
Postów: 313
Pomógł: 5
Dołączył: 22.03.2005

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


Witam chciałbym ten JS wstawić do zmiennej i mam z tym problem bo cały czas wywal błędy


  1. <?php
  2. $bilbord_glowna = "<script type="text/javascript">
  3. <!--
  4. if(!BSWFfile)
  5. {
  6. document.getElementById('bilbord').innerHTML = '<center><noscript><a href="reklama/adclick.php?n=a2ee9d7b" target="_blank"><img src="reklama/adview.php?clientid=28&amp;n=a2ee9d7b" border="0" alt=""></a></noscript></center>';
  7.  
  8.  if (!document.phpAds_used) document.phpAds_used = ',';
  9.  phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);
  10.  
  11.  document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
  12.  document.write ("reklama/adjs.php?n=" + phpAds_random);
  13.  document.write ("&amp;clientid=28");
  14.  document.write ("&amp;exclude=" + document.phpAds_used);
  15.  if (document.referrer)
  16. document.write ("&amp;referer=" + escape(document.referrer));
  17.  document.write ("'><" + "/script>");
  18.  
  19. }
  20. //-->
  21. </script>";
  22. ?>
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 3)
nospor
post
Post #2





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




Nie mozesz wstawic cudzyslowia (") do zmiennej objetej cudzyslowiem:
źle:
Kod
$zm = "cos " cos";


dobrze:

Kod
$zm = "cos \" cos";


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

"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
mefjiu
post
Post #3





Grupa: Zarejestrowani
Postów: 313
Pomógł: 5
Dołączył: 22.03.2005

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


Wiem o tym ale gdy wstawiam wszędzie gdzie jest cudzysłów " znak \ to mimo wszystko nie działa sad.gif

chyba sie udało
Go to the top of the page
+Quote Post
php programmer
post
Post #4





Grupa: Zarejestrowani
Postów: 1 045
Pomógł: 5
Dołączył: 8.11.2004
Skąd: trójmiasto

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


Niech to zrobi za ciebie funkcja addslashes" title="Zobacz w manualu PHP" target="_manual
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: 22.08.2025 - 03:05