Click to See Complete Forum and Search --> : Newbie PHP Question!


Anon
05-23-2002, 03:21 PM
Hi Guys,

I am a total newbie to php, so this is probably going to sound like a pretty stupid question!

I work predominently with Macromedia Director and Flash, I need to pass a variable from Director to a text file on my server.

Currently I have, and try not to laugh,

<?php
$basic = fopen("text.txt", "a+");
fputs($basic, $testVariable);
fclose($basic);
?>

testVariable is the name of my variable in Director.

Any help would be so greatfully appreciated!!

Thanks in advance.

harris97
05-24-2002, 12:35 AM
to write something to text.txt use fwrite instead fputs. fputs is using when you want to update content on text.txt file. so, try this:

<?php
$testVariable="hello world";
$basic = fopen("text.txt", "w");
fwrite($basic, $testVariable);
fclose($basic);
?>

and before execute, you should chmod text.txt to 777 for writing permisson. It is not necessary when you use localhost server (on your pc).

hope helps.