Jump to content
GIGN Forum

Php Teksts,saglabajas Txt Doc


Soprano
 Share

Recommended Posts

Sveiki,kā var dabūt gatavu šādu scriptu piemēram.....

(so ievada php dokumenta)

Vārds:kautkas

Vecums:99

un vins saglabajas txt dokumenta,darot to pashu vins neparaksta pari,bet pieliek klat piem...

Vārds:kautkas

Vecums:99

-----------------------

Vārds:kautkas

Vecums:99

-----------------------

Vārds:kautkas

Vecums:99

-----------------------

utt zinu ka tads scripts bija kautkur gign forumā bet nevareju atrast,moš kāds zin?

Link to comment
Share on other sites

$tavsfails= "aptauja.txt";
$fails = fopen($tavsfails, 'a') or die("nav/nevar atvērt failu");
$ieraksts = "Vārds $vaards\nVecums $vecums\n-----------------------------";
fwrite($fails, $ieraksts );
fclose($fails);

attieciigi mainiigo $vaards $vecums aizvieto ar savaam veertiibaam pie submit vai arii attieiciigi kaa tu tur taisi

Edited by BOT^a
Link to comment
Share on other sites

Pilns PHP kods

<?php
if (isset($_POST["vaards"]))
{
$vaards=$_POST["vaards"];
$vecums=$_POST["vecums"];
$tavsfails= "aptauja.txt";
$fails = fopen($tavsfails, 'a') or die("nav/nevar atvērt failu");
$ieraksts = "Vārds $vaards\nVecums $vecums\n-----------------------------";
fwrite($fails, $ieraksts );
fclose($fails);
}
?>
<form name="aptauja" action="" method="post">
Vārds:
<input type="text" name="vaards" />
<br />
Vecums:
<input type="text" name="vecums" />
<input type="submit" value="Ierakstam" />
</form>

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...