par
Lirio » 12 août 2010, 14:59
Bonjour,
On essaye quelque chose d'assez simple (et non testé) : un fichier formulaire.php divisé en deux parties : l'écriture et la lecture.
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
# Correspondance entre le nom du textarea et celui du fichier
$size = file_put_contents('fichier.txt', $_POST['fileContents']);
# Redirect after post.
header("Location: formulaire.php");
exit();
}
?>
<html><head><title>Mon formulaire</title></head><body>
<form action="formulaire.php" method="POST">
<textarea name="fileContents"><?php echo file_get_contents("fichier.txt"); ?></textarea>
<input type="submit" />
</form>
</body>
</html>
Bonjour,
On essaye quelque chose d'assez simple (et non testé) : un fichier formulaire.php divisé en deux parties : l'écriture et la lecture.
[php]
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
# Correspondance entre le nom du textarea et celui du fichier
$size = file_put_contents('fichier.txt', $_POST['fileContents']);
# Redirect after post.
header("Location: formulaire.php");
exit();
}
?>
<html><head><title>Mon formulaire</title></head><body>
<form action="formulaire.php" method="POST">
<textarea name="fileContents"><?php echo file_get_contents("fichier.txt"); ?></textarea>
<input type="submit" />
</form>
</body>
</html>
[/php]