ricshs Posted May 23, 2006 Report Share Posted May 23, 2006 (edited) <form action="action.php" method="post"> <p>e-pasts: <input type="text" name="e-pasts" /></p> <p>Parole: <input type="text" name="parole" /></p> <p><input type="submit" /></p> </form> Kā pielabot scriptu, lai ierakstītā lieta ierakstītos txt dokumentā, un submitējot parādītos cita lapa? Edited May 23, 2006 by ricshs Link to comment Share on other sites More sharing options...
Delfins Posted May 23, 2006 Report Share Posted May 23, 2006 SEARCH! Link to comment Share on other sites More sharing options...
SkyD Posted May 23, 2006 Report Share Posted May 23, 2006 action.php failā: <? echo $_POST['e-pasts']; echo $_POST['parole']; ?> ierakstīt failā: <? $fails="meesli.txt"; $atver=fopen($fails, "w"); $raksta=fwrite($atver, $_POST['e-pasts'].'|'.$_POST['parole']); ?> Link to comment Share on other sites More sharing options...
ricshs Posted May 23, 2006 Author Report Share Posted May 23, 2006 Tātad, tagad manā action.php failā ir esošais : <form action="action.php" method="post"> <p>e-pasts: <input type="text" name="e-pasts" /></p> <p>Parole: <input type="text" name="parole" /></p> <p><input type="submit" /></p> </form> Bet kur man jālie šis: <? $fails="meesli.txt"; $atver=fopen($fails, "w"); $raksta=fwrite($atver, $_POST['e-pasts'].'|'.$_POST['parole']); ?> Un ko dos, kad action php failā ierakstīs sho : <? echo $_POST['e-pasts']; echo $_POST['parole']; ?> Link to comment Share on other sites More sharing options...
SkyD Posted May 23, 2006 Report Share Posted May 23, 2006 :D Biku pārlasījos ne tā. Tos echo $_POST[''] nenjem galvā. <form action="cita_lapa.php" method="post"> To, kur raksta failā iebāz iekš cita_lapa.php. Link to comment Share on other sites More sharing options...
ricshs Posted May 23, 2006 Author Report Share Posted May 23, 2006 Jā, bet man nesanāk, es daru tā, atveru failu- action.php, un kura scriptu var redzēt augstāk un ierakstu vinjā <form action="burti.txt" method="post"> Tagad atveru caur pārlūku savu lapu, kur prasa login un pasw ievadu kkādus ciparus un spiezhu submit, tad atveru failu burti.txt, bet tur nekā nav, kadēļ tā ? Link to comment Share on other sites More sharing options...
Blitz Posted May 23, 2006 Report Share Posted May 23, 2006 Varbut vispirms apgusti kautvai minimali html? Link to comment Share on other sites More sharing options...
john.brown Posted May 23, 2006 Report Share Posted May 23, 2006 (edited) Tak skaties foruma satura rādītāju, tur kaudze ir par rakstīšanu failā. http://php.lv/f/index.php?showtopic=2935 Un ko tu cerēji, kas tev būs submitojot uz text failu? Edited May 23, 2006 by john.brown Link to comment Share on other sites More sharing options...
SkyD Posted May 23, 2006 Report Share Posted May 23, 2006 burti.txt failaa ieraksti Šurum burum tu tagad māki PHP no a-z Ej uz pārlūku un izdari tāpat kā iepriekš, un notiks brīnums. Link to comment Share on other sites More sharing options...
blackhalt Posted May 23, 2006 Report Share Posted May 23, 2006 Tur komentāros ir dažādi piemēri: http://lv.php.net/manual/en/function.fopen.php http://lv.php.net/manual/en/function.fwrite.php http://lv.php.net/manual/en/function.file.php Link to comment Share on other sites More sharing options...
ricshs Posted May 23, 2006 Author Report Share Posted May 23, 2006 Un ko tu cerēji, kas tev būs submitojot uz text failu? nu, jā, tāda bija iecere, bet nemāku tādu uzbuvēt =\ Link to comment Share on other sites More sharing options...
SkyD Posted May 23, 2006 Report Share Posted May 23, 2006 Tev taa login forma jaieliek forma.html. forma.html <form action="action.php" method="post"> <p>e-pasts: <input type="text" name="e-pasts" /></p> <p>Parole: <input type="text" name="parole" /></p> <p><input type="submit" /></p> </form> action.php <? $fails="meesli.txt"; $atver=fopen($fails, "w"); $raksta=fwrite($atver, $_POST['e-pasts'].'|'.$_POST['parole']); echo 'Darbs padarīts. Drīksti iet uz tualeti.'; ?> Link to comment Share on other sites More sharing options...
ricshs Posted May 23, 2006 Author Report Share Posted May 23, 2006 (edited) Vot, paldies, bet es nedaudz pārveidoju iedoto scriptu, es uzliku, lai , kad ievada paroli rādās zīmes "*****," bet lieta tāda, ka tagad dokumentā meesli.txt nerādās paroles. Forma html: <form action="action.php" method="post"> <p>e-pasts: <input type="text" name="e-pasts" /></p> <p>parole: <input name="482fb7adbb" size="23" type="password"><br></p><p><input type="submit" /></p> </form> Action.php: <? $fails="meesli.txt"; $atver=fopen($fails, "w"); $raksta=fwrite($atver, $_POST['e-pasts'].'|'.$_POST['parole']); echo 'Darbs padarīts. Drīksti iet uz tualeti.'; ?> Kas varētu but nepareizi? Kad visu ierakstu un submitēju, tad .txt dokumentā tikai ierakstās: mans@epasts.lv | bet_neuzradas_parole,_paliek_tuksha_vieta! Kā to labot? Edited May 23, 2006 by ricshs Link to comment Share on other sites More sharing options...
blackhalt Posted May 23, 2006 Report Share Posted May 23, 2006 <input name="482fb7adbb" jābūt <input name="parole" Link to comment Share on other sites More sharing options...
ricshs Posted May 23, 2006 Author Report Share Posted May 23, 2006 (edited) EV!!!! Blackhalt!!!! Paldies! Tu nemaz nezini, kā tas man bija vajadzīgs!!! :D Tiešām paldies! Edited May 23, 2006 by ricshs Link to comment Share on other sites More sharing options...
Recommended Posts