dipps
Goto Top

JavaScript Array per PHP erstellen

JavaScript Array per PHP erstellen

Hallo ich erstelle ein JavaScript Array per echo in PHP
es kommt folgendes in JavaScript an
arti[1007]= new Array();
arti[1007]='1007';  
arti[1007][1]='Fan-Trikot XXXS';  
arti[1007][2]='Trikot in der Größe XXXS';  
arti[1007][3]='25';  
arti[1007][4]='/img/leer.jpg';  
arti[1007][5]='';  
arti[1007][6]='';  

arti[1010]= new Array();
arti[1010]='1010';  
arti[1010][1]='Fanschal';  
arti[1010][2]='Schal mit dem Schriftzug "FSV Budissa Bautzen"  
doppelseitig bedruckt

(Abbildung ähnlich)';  
arti[1010][3]='10';  
arti[1010][4]='/img/1010.jpg';  
arti[1010][5]='';  
arti[1010][6]='';  

arti[1020]= new Array();
arti[1020]='1020';  
arti[1020][1]='Fan T-Shirt L';  
arti[1020][2]='T-Shirt in der Größe L';  
arti[1020][3]='7';  
arti[1020][4]='/img/1020.jpg';  
arti[1020][5]='';  
arti[1020][6]='';  

arti[1021]= new Array();
arti[1021]='1021';  
arti[1021][1]='Fan T-Shirt M';  
arti[1021][2]='T-Shirt in der Größe M';  
arti[1021][3]='7';  
arti[1021][4]='/img/1021.jpg';  
arti[1021][5]='';  
arti[1021][6]='';  
bei arti[nr] ist die PHP Variable $dss[1] und soweiter dann sprich [2] [3] und weiter.
PHP holt sich die Daten aus einer DB Tablle wobei artik[...][2] in der DB als Text gespeichert ist und auch Zeilen Umbrüche drin haben kann.

Wie bekomme ich die Zeilen umbrüche im Java script Code raus?
Ich denke mal sicherlich per PHP.
Speziell geht es mir um Zeile 13 das er die Zeilen umbrüche raus macht aber nicht löschen da bei der Anzeige im Browser ja es forhanden sein soll der Zeilen Umbruch.

Content-Key: 160777

Url: https://administrator.de/contentid/160777

Printed on: April 20, 2024 at 03:04 o'clock

Member: SlainteMhath
SlainteMhath Feb 15, 2011 at 09:45:28 (UTC)
Goto Top
Moin,

Wie bekomme ich die Zeilen umbrüche ... raus?

im PHP Script:
$variable=str_replace("\n"," ",$variale);  

lg,
Slainte
Member: Arano
Arano Feb 15, 2011 at 16:01:36 (UTC)
Goto Top
Member: nxclass
nxclass Mar 02, 2011 at 08:45:40 (UTC)
Goto Top
.. na hoffentlich hast Du nicht mal ein ' in der Zeichenkette.