1 Reply Latest reply on Aug 1, 2008 6:58 PM by Pinkmischief

    Flash + PHP ??

    Pinkmischief
      Hi guys i have been trying to do a simple login for the past 7 hours with the following Objectives.
      1.User logs in
      2.User gets forwarded to page ( for testing purposes ) to echo out the $_POST vars sent from Flash.

      Now after 7 hours and about 6000 strands of hair being pulled out and going to hospital with head injurys as i feel like im bashing my head on a brick wall here , Im praying that one or some of you people on here would be kind enough to point out what im doing wrong please.

      Im quite proficient in PHP but this Actionscript seems impossible to work with lol

      Here is my actionscript code.

      var WebAddress:String =" http://localhost/flash/functions/login.php";


      for(var i:Number = 1; i<100; i++){
      age.addItem(i);
      }

      myBtn_btn.onRelease = function() {
      var Age:Number = age.selectedIndex+1;
      var Username:String = username.text;
      var Userpassword:String = userpass.text;

      trace("You are "+Age+" years old and Your username is "+Username+ " And your password is " +Userpassword);
      getURL(WebAddress, "_blank", "POST");
      }


      Now this traces out the information fine.
      Traced Info : You are 25 years old and Your username is Admin And your password is Testing.

      But its when i try to send this to the login.php page it all goes pearshaped all i get back from that page with a simple print_r($_POST); on it is these values :S

      Values Shown from PHP : Array ( [WebAddress] => http://localhost/flash/functions/login.php => 100 [_childCounter] => 1 )

      Now wheres my Username,Userpassword and Age variable gone :S

      Please help its driving me mad :(
        • 1. Re: Flash + PHP ??
          Pinkmischief Level 1
          YES!!! I finally managed to solve this problem after almost 12 hours of trying to get it to work :S
          I will post the edited code for others who may find this useful to know in their logins

          I found declaring the Vars and the assigning them values during the Button release worked fine for me.

          [code]
          var WebAddress:String =" http://localhost/flash/functions/login.php";
          var Age:Number
          var Username:String
          var Userpassword:String
          for(var i:Number = 1; i<100; i++){
          age.addItem(i);
          }


          myBtn_btn.onRelease = function() {

          Age = age.selectedIndex+1;
          Username = username.text;
          Userpassword = userpass.text;
          trace("You are "+Age+" years old and Your username is "+Username+ " And your password is " +Userpassword);
          getURL(WebAddress, "_blank", "POST");
          }

          [/code]