Jump to content

Send Variable from Flash to Php Script not working...


Recommended Posts

Hey

 

I am struggling with sending some variables to a php page from my flash movie. On the last frame of my flash movie i have a button which navigates the user onto a new php page where i want to display the variables in. The code i currently have is :

 

AS3 -

// set variables as a string containing the dynamic textfield.
var Introduction:String = (introduction_txt.text);
//
var Choices:String = (summary_txt.text);
//

//// Send Variable to php.
var requestVar:URLRequest = new URLRequest ("http://www.photoincanvas.co.uk/shopping-basket.php");
request.method = URLRequestMethod.POST;

var variables:URLVariables = new URLVariables();

variables.Intro = "Introduction";
variables.Choices = "Choices";			
request.data = variables;

var loaderVar:URLLoader = new URLLoader (request);
loaderVar.addEventListener(Event.COMPLETE, onComplete);
loaderVar.dataFormat = URLLoaderDataFormat.VARIABLES;
loaderVar.load(request);

function onComplete (event:Event):void{
status_txt.text = event.target.data;
}

 

PHP code on new page -

<?php

$intro = $_POST['Intro'];
$choice = $_POST['Choices'];

echo "Intro=" . $intro;

?>

 

The echo in the php page comes up as Intro=,

I need to echo the variable of $intro which contains the dynamic text in 'introduction_txt.text' in flash.

 

If anyone can help me out on this one??

 

Many Thanks

 

Jon

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.