# Flash accepting and sending variables

**URL:** <https://forum.kirupa.com/t/flash-accepting-and-sending-variables/38691>\
**Category:** flash\
**Created:** [December 28, 2003, 9:00am UTC](https://forum.kirupa.com/t/flash-accepting-and-sending-variables/38691 "2003-12-28T09:00:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chimaerax](https://avatars.discourse-cdn.com/v4/letter/c/d9b06d/32.png) [@chimaerax](https://forum.kirupa.com/u/chimaerax)\
**Post date:** [December 28, 2003, 9:00am UTC](https://forum.kirupa.com/t/flash-accepting-and-sending-variables/38691/1 "2003-12-28T09:00:02Z")

</div>

How can I make Flash accept a numerical variable from a webpage and send the variable back to a webpage? Something like a counter, which counts the number of times the Flash is loaded.

I want Flash to read a numerical value maybe from a txt file(any other ways?), add 1 to it, and send it back to a PHP script.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 28, 2003, 10:46am UTC](https://forum.kirupa.com/t/flash-accepting-and-sending-variables/38691/2 "2003-12-28T10:46:18Z")

</div>

Welcome to the fourms. Search for this topic it’s been asked MANY times here before.

essentially you’d be using :

```auto

//to send only
sendVars = new LoadVars();
sendVars.myValue = "this is what my var is";
sendVars.send("myphppage.php","POST");
//to load vars from php
sendVars = new LoadVars();
getVars.onLoad = function(){
trace(this.myValue);
}
getVars.load("myPHPpage.php");
//combining the two into one function
sendVars = new LoadVars();
getVars = new LoadVars();
sendVars.myValue = "this is what my var is";
getVars.onLoad = function(){
trace(this.myValue);
}
sendVars.sendAndLoad("myphppage.php",getVars,"POST");

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 28, 2003, 11:20am UTC](https://forum.kirupa.com/t/flash-accepting-and-sending-variables/38691/3 "2003-12-28T11:20:34Z")

</div>

Sorry I’m kindda new to Actionscript, and can’t test it myself as I don’t do PHP. Will the following work? I’m using Flash to load a variable, add 1 to it, and send the variable to another page.  
Btw, what does trace(something) do?

[AS]

getVars = new LoadVars();  
getVars.onLoad = function(){  
trace(this.counter);  
}  
getVars.load(“myPHPpage1.php”);

getVars += 1;

getVars.send(“myPHPpage2.php”, “POST”);

[/AS]
