# Sending Variables PHP to FLASH 8

**URL:** <https://forum.kirupa.com/t/sending-variables-php-to-flash-8/222523>\
**Category:** flash\
**Created:** [April 14, 2007, 9:05am UTC](https://forum.kirupa.com/t/sending-variables-php-to-flash-8/222523 "2007-04-14T09:05:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lastradius](https://avatars.discourse-cdn.com/v4/letter/l/46a35a/32.png) [@lastradius](https://forum.kirupa.com/u/lastradius)\
**Post date:** [April 14, 2007, 9:05am UTC](https://forum.kirupa.com/t/sending-variables-php-to-flash-8/222523/1 "2007-04-14T09:05:16Z")

</div>

The following two examples are quite simple and for the life of me I can’t figure out what is wrong. I must have spent all of two days unsuccessfully searching the internet for some insight.

Thanxs in Advance: Lastradius

EXAMPLE 1:

Can anybody tell me why the following code reads $fname $lName and $age in the Output Panel of Flash when I’m expecting to see Lazlo Bernini and 36 returned from the php script.

THE SWF FILE

var rData:LoadVars = new LoadVars();  
rData.load(“external.php”);  
rData.onLoad = function(){  
trace(this.fName);  
trace(this.lName);  
trace(this.age);  
};

THE PHP FILE:

\<?php  
$fName = “Lazlo”;  
$lName = “Bernini”;  
$age = 36;  
echo ("&fName=$fName&lName=$lName&age=$age&");  
?\>

EXAMPLE 2:

Pretty simple, right, the flashCount is sent to the PHP script, iterated, and returned with a value of 2. Only problem is my Output panel simply reads ‘$phpCount’. I don’t have a clue what’s wrong!

SWF FILE

var rData:LoadVars = new LoadVars();  
rData.flashCount = 1;

rData.onLoad = function() {  
var newFlashCount = rData.theCount;  
trace(newFlashCount);  
};

rData.sendAndLoad(“external.php”, rData, “POST”);

PHP FILE:

\<?php  
$phpCount = $\_POST[‘flashCount’];  
$phpCount++;  
echo “&theCount=$phpCount&”;  
?\>
