MeTRoiD Posted June 26, 2007 Report Share Posted June 26, 2007 Kāds scripts būtu jāizveido, lai varētu no mājas lapas pievienot .txt failam dažas rindiņas..? Aptuveni tā.. text [ lodziņš ] text [ lodziņš ] text [ lodziņš ] ok un .txt failā saglabājās šādā formātā.. text:text:text .. Nau nejausmas ar ko sākt.. Maybe kādam ir kāds iesākts scripts.. + Ja ir iespējams, tad arī lai nevar pievienot vairākus ar vienādu textu.. [ bet tas tā.. ] Link to comment Share on other sites More sharing options...
Delfins Posted June 26, 2007 Report Share Posted June 26, 2007 šeit forumā 10x apspriests un skripti arī N-tie... Link to comment Share on other sites More sharing options...
MeTRoiD Posted June 26, 2007 Author Report Share Posted June 26, 2007 pff... āā, aptuveni kā lai es meklēju, man tiešām nau ne jausmas.. Link to comment Share on other sites More sharing options...
andrisp Posted June 26, 2007 Report Share Posted June 26, 2007 php.net/fwrite Link to comment Share on other sites More sharing options...
MeTRoiD Posted June 26, 2007 Author Report Share Posted June 26, 2007 php.net/fwrite Nekas neizdevās.. Scriptam vajag pievienot arī lodziņu kur ierakstīt, bet tur tikai uzpiet uz .php faila un noteikt teksts pievienojas .txt failam.. Link to comment Share on other sites More sharing options...
Val Posted June 26, 2007 Report Share Posted June 26, 2007 uztaisi formu, kuras textarea'ā ielasi faila saturu un pie formas postošanas saglabā to failu. Link to comment Share on other sites More sharing options...
cucumber Posted June 26, 2007 Report Share Posted June 26, 2007 Neiesaku kerties uz reizs tik grutam lietam, ja jau nezin ka formas padot datus php. Link to comment Share on other sites More sharing options...
MeTRoiD Posted June 26, 2007 Author Report Share Posted June 26, 2007 ēēē, bet tur tā lieta, ka simple php tur jeu gatavu kodu editēt māku, bet cept kaut ko no jauna nevaru.. āā, bet ļoti man vajag to fišku uzveidot.. Link to comment Share on other sites More sharing options...
andrisp Posted June 26, 2007 Report Share Posted June 26, 2007 Taču ieraksti iekš šī paša foruma meklēšanā fwrite un izej cauri visiem pirmās lapas postiem. Noteikti atradīsi to, ko gribi. Link to comment Share on other sites More sharing options...
MeTRoiD Posted June 27, 2007 Author Report Share Posted June 27, 2007 Jā, atradu.. index.php kods <html> <head> <title>=]</title> <body> <center> <table border="0"> <font size="3"><b>Ieraksti kautko :)</b></font> <tr> <td> <form action="write.php" method="post"> <textarea rows="1" cols="30" name="sometext"> </textarea> </td></tr> <tr><td> <input type='submit' name="submit" value="Submit" > </form> </table> </center> </body> </html> write.php kods <? $thedata = $_POST['sometext']; $file = "spam.txt"; $open = fopen($file, "a"); $write = fwrite($open, $thedata); ?> Čut čut jāpāreveido, lai pēc tā sometext parādās vēlviens teksts.. [ parādās tikai .txt failā ] .. kāds varētu? Mēģinu jeu te kādu pusstundu, nekā nesanāk.. Link to comment Share on other sites More sharing options...
andrisp Posted June 27, 2007 Report Share Posted June 27, 2007 (edited) Pievieno HTML formai klāt vēl textarea vai input lauku. Piemēram: <textarea rows="1" cols="30" name="sometext2"> Un iekš PHP koda ieliec kaut ko šādu: $thedata = $_POST['sometext'].'|'.$_POST['sometext2']; Edited June 27, 2007 by andrisp Link to comment Share on other sites More sharing options...
MeTRoiD Posted June 27, 2007 Author Report Share Posted June 27, 2007 āā, nepareizi laikam pateicu, ko vēlos.. āā, vēlos lai ir tas viens lodziņš, un kad ieraksta tur info un uzpiež ok, aiz tā teksts parādās vēlviens teksts.. Tikai .txt failā Man liekas šeit vajag kko pielikt aizmugurē klāt $thedata = $_POST['sometext']; un aiz šī tas teksts ko vēlos lai parādās .txt failā.. bet nemāku.. Link to comment Share on other sites More sharing options...
andrisp Posted June 27, 2007 Report Share Posted June 27, 2007 $thedata = $_POST['sometext'] . 'tavs teksts'; http://lv.php.net/language.operators.string Link to comment Share on other sites More sharing options...
MeTRoiD Posted June 27, 2007 Author Report Share Posted June 27, 2007 Nice.. Done.. ā, meklēju forumā, bet nesapratu kurš ir īstais, lai pēc tam, kad .txt failā ir pievienojies tas teksts, nākošais kurš rakstīs sāktu jaunā rindā.. Pasakiet lūdzu, un tnx jeu par visu.. Link to comment Share on other sites More sharing options...
v3rb0 Posted June 27, 2007 Report Share Posted June 27, 2007 fopen(.. 'a'); un "\n", ja pats nesāk jaunā rindā Link to comment Share on other sites More sharing options...
Recommended Posts