PDA

View Full Version : Overwriting .txt on POST (PHP)


Denexus
10-30-2005, 10:14 PM
Overwriting .txt on POST

(What I need is when text is posted it replaces the previous text with the new entered text in the .txt file)

I was able to get this to work, originally having issues on testing because of server restrictions. Although now its posting new info to the text file and adding to the list rather then replacing what was already in the txt file.


-------------------------------------------
(PHP)
-------------------------------------------
<?php
$name = $_POST['said'];
$said = fopen("MyFile.txt", "a+");
fwrite($said, "$name
");
fclose($said);
?>

-------------------------------------------
(ACTIONSCRIPT)
-------------------------------------------
on(release){
loadVariablesNum("write.php", 0, "POST")
}
-------------------------------------------

Denexus
10-30-2005, 10:36 PM
(FIXED)
in the PHP change a+ to (w+ or wb+ or w+b)