# \_\_\_\_\_\_\_\_\_\_\_Saving/Loading variables with PHP

**URL:** <https://forum.kirupa.com/t/-----------saving-loading-variables-with-php/135361>\
**Category:** Uncategorized\
**Created:** [January 26, 2005, 8:42pm UTC](https://forum.kirupa.com/t/-----------saving-loading-variables-with-php/135361 "2005-01-26T20:42:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![volcomp](https://avatars.discourse-cdn.com/v4/letter/v/94ad74/32.png) [@volcomp](https://forum.kirupa.com/u/volcomp)\
**Post date:** [January 26, 2005, 8:42pm UTC](https://forum.kirupa.com/t/-----------saving-loading-variables-with-php/135361/1 "2005-01-26T20:42:36Z")

</div>

Hi there,

I’m trying to save a change to a text document (In this case a variable “Title” just to test) and then view the changes from another swf movie…

In the end I’m hoping to build a client updatable flash site. In particular menu items… feature items & prices.

A Recap: a client types in the items, php/flash saves the changes to the text document, and site visitors can views those changes.

Something in my code isn’t clicking:

My PHP is:

```auto
<?php
   $Title = $_POST['Title'];
   $toSave = "Title=".$Title;
   //Open a file in write mode
   $fp = fopen("content.txt", "w");
   if(fwrite($fp, $toSave)) echo "writing=Ok";
   else echo "writing=Error";
   fclose($fp);   
?>

```

My ActionScript is

```auto
submit.onPress = function(){
if(Title.text!=""){
myData.Title = Title.text
myData.sendAndLoad("save.php", myData, "POST")
}
}
myData = new LoadVars()
myData.onLoad = function(){
if(this.writing=="Ok") {
gotoAndStop(2) 
status.text = "Submited data was saved"
}
else status.text = "Error in saving submitted data"
}
stop()

```

I’ve been told to try more simple code like

```auto
this.loadVariables("save.php";"POST");

```

But I’m not sure where to put it?!

- B
