Results 1 to 1 of 1

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

  1. #1
    Join Date
    Dec 2009
    Posts
    14

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

    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 -
    Code:
    // 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 ("new-page.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 -
    Code:
    <?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
    Last edited by oddball25; 09 Jan 2010 at 01:22 PM.

Similar Threads

  1. PHP Image Upload with Flash Editing
    By oddball25 in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 15 Dec 2009, 04:19 PM
  2. Simple php 'write to' script not working??
    By elli in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 15 Nov 2007, 08:05 PM
  3. Register script not working (php)
    By ilovefishsticks in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 14 May 2006, 01:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •