2 Replies Latest reply on Apr 17, 2006 3:20 AM by Mrinal Banerjee

    Flash & Php

    Mrinal Banerjee
      I want to pass a variable from flash to php. How do I do that?? I am using Flash 8. I had written the code in flash that loads php file given below..

      myXml.load("myphp.php?myVar="somevalue);

      And I had written in myphp.php file to catch the variable;
      $value=HTTP_GET_VARS[myVar];

      But it do not work... Pls help me...
        • 1. Re: Flash & Php
          sneakyimp Level 2
          have you defined myXml as an xml object yet? if not, the .load command is going to be meaningless.

          furthermore, your xml variable expects your php file to return some xml. do you have your php file outputting any xml values?

          lastly, you need a dollar sign ($) in front of HTTP_GET_VARS and some quotes around myVar like this:

          $value = $HTTP_GET_VAR['myVar'];

          Generally speaking, you will get better results if you provide the exact code your are having trouble with. Don't post ALL of it necessarily, but enough for someone to make a diagnosis.
          • 2. Re: Flash & Php
            Mrinal Banerjee Level 1
            Ok Sneakyimp... I privide all of my codes there... In my Flash I add two text area named status_txt and output_txt.and written a Frame script like..
            stop();
            var value:String="Mrinal"
            var myXml:XML=new XML();
            myXml.ignoreWhite=true;
            myXml.onLoad=function(success:Boolean){
            if (success){
            Status_txt.text=" Loaded Properly";
            output_txt.text=myXml.toSting();
            }else{
            Status_txt.text=" Error Loading Xml";
            }
            }
            loginDetailXml.load("myphp.php?myVar="value);

            In myPhp.php file I had witter a code like below:

            <?php
            $key = $HTTP_GET_VARS['myVar'];
            echo '<?xml version="1.0" encoding="UTF-8"?>';
            echo '<datapacket>';
            while($row=mysql_fetch_array($result)){
            $line = '<row value="'.$key.'" />';
            echo $line;
            }
            echo '</datapacket>';
            ?>