Ben bir. Txt dosyası adlarını almak için çalışıyorum. Ben dosyayı kullanıyorum ('filename.txt') ama ben isimlerini denemek ve Döşeme döngü için bir php kullanmak, eğer birden fazla satır çıkıyor:
Bu javascript yazdıran gerçek hat (NOT: böylece çalışması gerekir Elinizde kod kalanını sorunu çözebilirsiniz eğer ben, seçkin bir kutunun içine bu isimleri koyarak gidiyorum sürece bunu don ile büyük bir sorun 't comment gerekir)
<?php
for($i=1; $i < 27; $i++){
echo "selbox.options[selbox.options.length] = new Option('".lines[$i]."','".$lines[$i]."');\n";
}
?>
Bu tarayıcıda çıkıyor nasıl heres:
selbox.options[selbox.options.length] = new Option('Djamal ABDOUN
','First1 Last1
');
selbox.options[selbox.options.length] = new Option('Chadli AMRI
','First2 Last2
');
I need those to be on one line so i dont get a unterminated string literal js error Any ideas on what i can do here?
EDIT: Oh i should probably mention, the $lines var is initiated like this: $lines = file('filename.txt'); and inside that file i have formatted like this First1 Last1 First2 Last2 First3 Last3 etc. and i hit delete after each Last name until the next first name is touching, then hit enter to put it on a new line (Editor is notepad++)