Writing Variables

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
matty41a
Forum Newbie
Posts: 1
Joined: Fri May 24, 2002 11:22 am

Writing Variables

Post by matty41a »

Hi all,

I'd really appreciate some help writing my variable to a text file on my server. I'm writing the program in Macromedia Director and using the following code:

on mouseUp me
postnettext("http//www.volume54.com/dcy4/app/add.php?", testVariable)
end

with the PHP:

<?php

function writefile("text.txt","$testVariable","a+")

{

$fp = fopen($filename, $mode);

fwrite($fp, $data);

fclose($fp);

}

?>

Can anyone tell me why this wont work? The variable is named testVariable in Director.

All input is greatly appreciated!!

Many thanks.
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post by jason »

This:

Code: Select all

postnettext("http//www.volume54.com/dcy4/app/add.php?", testVariable)
Should be:

Code: Select all

postnettext("http//www.volume54.com/dcy4/app/add.php?variableName", value)
And to use the variable, use:

Code: Select all

$_GET&#1111;'variableName']
or

Code: Select all

$HTTP_GET_VARS&#1111;'variableName']
depending on your version of PHP. That should help.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

I took a look in the lingo reference
try

Code: Select all

postnettext("http//www.volume54.com/dcy4/app/add.php","testVariable=what+ever")

Code: Select all

&lt;?php
function writefile($filename,$data,$mode)
{ 
   $fp = fopen($filename, $mode); 
   fwrite($fp, $data); 
   fclose($fp); 
} 
function writefile("text.txt",$_POST&#1111;'testVariable'],"a+")
?&gt;
Post Reply