Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Edycja
Robert
post
Post #1





Grupa: Zarejestrowani
Postów: 117
Pomógł: 0
Dołączył: 2.05.2003

Ostrzeżenie: (0%)
-----


Witam zrobilem sobie edytowanie zapisanych w plikach "dat" informacji. Lecz pojawil sie jeden blad. Mianowicie skrypt nie wyswietla mi w textarea informacji z pliku *.dat. Zaprezentuje skrypt moze on cos rozwiaze.
formularz.php3
Kod
<table width="280" align=center  style="border: 1px solid black" cellspacing=1 cellpadding=1>

  <!--DWLayoutTable-->

  <form action="index.php?page=dodaj" method=post>

    <tr>

      <td width="100%" height="16" valign="top">Aktualizuj:</td>

    </tr>

    <tr>

      <td valign="top"><textarea cols=50 rows=10 name=tresc></textarea></td>

    </tr>

    <tr>

      <td ><input type=submit value=Dodaj> <input type=reset value=Reset>

        <br>

      </td>

    </tr>

  </form>

</table>


dodaj.php3
[php:1:40ff30a823]<?php
$fp = fopen('includes/dat/aktual.dat', 'r');
$stareDane = fread($fp, filesize('includes/dat/aktual.dat'));
fclose($fp);

$data = date("d.m.Y");
$noweDane="$data||$trescn";
$noweDane .= $stareDane;

$fp = fopen('includes/dat/aktual.dat', 'w');
fputs($fp, $noweDane);
fclose($fp);

echo("Aktualizacja zostala dodana. Zobacz aktualizacje <a href=index.php?page=index>tutaj</a>");

?>[/php:1:40ff30a823]

edit.php3
[php:1:40ff30a823]<?
$file = file("includes/dat/aktual.dat");
$total = count($file);
for($i=0; $total > $i; $i++){
$info = explode("||", $file[$i]);
}
?>
<table width="280" align=center style="border: 1px solid black" cellspacing=1 cellpadding=1>
<!--DWLayoutTable-->
<form action="index.php?page=dodaj" method=post>
<tr>
<td width="100%" height="16" valign="top">Edytuj</td>
</tr>
<tr>
<td valign="top"><textarea cols=50 rows=10 name=tresc value="<? echo $info[0]; ?>"></textarea></td>
</tr>
<tr>
<td ><input type=submit value=Edit> <input type=reset value=Reset>
<br>
</td>
</tr>
</form>
</table>[/php:1:40ff30a823]

Wklejam wszystkie pliki by wszytko bylo jasne smile.gif.
Pozdrawiam winksmiley.jpg
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 06:18