keiby Posted June 16, 2004 Report Share Posted June 16, 2004 (edited) ir sekojosh kods : <? for($i=1; $i<=$option; $i++){ $subdata=explode("][",$data[$i]); echo " <tr> <td>Atbildes variants $i : </td> <td><input type=\"text\" name=\"answer[$i]\" size=\"40\" maxlength=\"40\" value=\"$subdata[0]\"></td> <td><input type=\"text\" name=\"image[$i]\" size=\"25\" maxlength=\"50\" value=\"$subdata[1]\"></td> <td><input type=\"text\" name=\"votes[$i]\" size=\"4\" maxlength=\"4\" value=\"$subdata[2]\"></td> </tr> "; } ?> kursh nolasa no txt faila datus, kuri, piemeeram, ir saglabaati shaadaa veidaa : bla bla 1][bla bla][50 bla bla 2][bla bla][60 viss, protamz, straadaa, bet man nepatiik viena lieta - kaa vinjsh paartaisa kodu, kas redzams sourcee (shajaa gadiijumaa) : <tr> <td>Atbildes variants 1 : </td> <td><input type="text" name="answer[1]" size="40" maxlength="40" value="bla bla 1"></td> <td><input type="text" name="image[1]" size="25" maxlength="50" value="bla bla"></td> <td><input type="text" name="votes[1]" size="4" maxlength="4" value="50 "></td> </tr> <tr> <td>Atbildes variants 2 : </td> <td><input type="text" name="answer[2]" size="40" maxlength="40" value="bla bla 2"></td> <td><input type="text" name="image[2]" size="25" maxlength="50" value="bla bla"></td> <td><input type="text" name="votes[2]" size="4" maxlength="4" value="60 "></td> </tr> kaa redzams, tad peec treshaas veertiibas (votes) nolasiishanas tiek ielikc enters, tb, viss paareejais tiek paarnesc naakamajaa rindinjaa. Edited June 16, 2004 by keiby Link to comment Share on other sites More sharing options...
Aleksejs Posted June 16, 2004 Report Share Posted June 16, 2004 A tu nevari datus glabāt šādi: bla bla 1][bla bla][50][ bla bla 2][bla bla][60][ ??? tas dos to, ka tiks ielasīts papildus elements (kuru tu gan nekad neizmantosi, kurā arī būs tas enters). Link to comment Share on other sites More sharing options...
keiby Posted June 16, 2004 Author Report Share Posted June 16, 2004 A tu nevari datus glabāt šādi:bla bla 1][bla bla][50][ bla bla 2][bla bla][60][ ??? tas dos to, ka tiks ielasīts papildus elements (kuru tu gan nekad neizmantosi, kurā arī būs tas enters). shitaadu variantu jau biju pirms tam izmeegjinaajis. straadaaja. vnk. pirms tam biju izmantojis shaadu datu saglabaashanas veidu un nebija shitaadas probleemas. taapeec arii prasiiju sheit. Link to comment Share on other sites More sharing options...
Kaklz Posted June 16, 2004 Report Share Posted June 16, 2004 katrai rindai pēc nolasīšanas no faila vari uztaisīt trim(), tas novāks liekos space sākumā un beigās, kā arī \n simbolu beigās un nebūs tev nekādu problēmu ;) Link to comment Share on other sites More sharing options...
Venom Posted June 17, 2004 Report Share Posted June 17, 2004 1) sadalít ar ko citu, parasti lieto |, jo tas sastopas reti 2) trim, rtrim 3) echo "<td><input type=\"text\" name=\"answer[$i]\" size=\"40\" maxlength=\"40\" value=\"$subdata[0]\"></td>" vietá izmantot echo '<td><input type="text" ...</td>'; un nemocíties ar " atsleshoshanu Link to comment Share on other sites More sharing options...
Recommended Posts