Read / Write to external text file from flash

(I don’t know if I should post this in FlashMX of actionscript)

Hi pieps,
I hope someone can help me out here.
I am trying to make a banner that shows percentages from a external text file. The percentages are showing the interest on a morgage for 1 year, 5 years 10 years. So the banner is showing more then one percentage.
I have come so far that the banner is showing the percentages from a external text file. I added the %-sign in the action script.
All working fine until now…
Now what I want is to ba able to change the percentages through the banner. So I was thinking of a hidden button on the banner that brings you to a password field. If correct password, leads you to a input box (or 3 input boxes). Here you can insert the new percentages and then click on GO!
The flash movie should then ‘talk’ to a php-script that writes the new percentages to the external text file where the flash movie is reading the percentages from. So the next time someone will view the banner, they will see the new percentages.
But you know how a external text file, where flash reads it’s info, looks like… percentageOneYear=2&percentageFiveYear3&… etc.
How does the php-file know how to change only the right number?
Can anyone help me with that last part (php part).
That would be very helpfull.

Maby my way is not the best or the easyest, so help on more then only the technical level would be more then welcome.


$textString = file_get_contents("php://input");
if ($textString!= NULL){
$file = fopen("text.txt", "w+") or die("cant open the text file");
if(!fwrite($file, $textString)){
print "cant write to the file, change the CHMOD permissions  of the file to 777";

print "success";

ok, you have to send the data to the script with the sendAndLoad() method so you can recibe the “print” answer from the php script. Send the script already formated from flash (“percentageOneYear=2&percentageFiveYear3&…” etc.)
next time post in the server side forum